Bug?

For questions about using Classic.

Post » Tue Nov 23, 2010 5:40 pm

Everything was okey till i instaled Resource Access Plugin. then when i start to run my game it goes:


nevermind

aparently this is what was cousing the problem



any idea why?
ImageImageImageImage
B
26
S
7
G
7
Posts: 572
Reputation: 6,097

Post » Tue Nov 23, 2010 10:48 pm

You have two conditions on 6. Else means run if the tied condition is not met, so another condition saying not to run causes the error.
Image Image
B
161
S
48
G
91
Posts: 7,358
Reputation: 67,271

Post » Tue Nov 23, 2010 11:07 pm

[quote="newt":2uqm8xa8]You have two conditions on 6. Else means run if the tied condition is not met, so another condition saying not to run causes the error.[/quote:2uqm8xa8]
Not necessarily, no. Something like this works fine:

[code:2uqm8xa8]+ n equals 6

+ else
n equals 5

+ else
n equals 4

+ else[/code:2uqm8xa8]

But there is another possible problem. Are you trying to modulo divide by 0? That's not possible (although I expected Construct to catch such error)
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Tue Nov 23, 2010 11:46 pm

does this help?

B
17
S
5
G
3
Posts: 9
Reputation: 1,593

Post » Wed Nov 24, 2010 6:36 am

actualy i was just an idiot and though that if i write % mark it would (just as using your calculator) divide. forgoten this obvious fact that 10% are in fact 0.10, and to get 10% of something i need it be multiply by 0.10.
ImageImageImageImage
B
26
S
7
G
7
Posts: 572
Reputation: 6,097

Post » Wed Nov 24, 2010 7:01 am

[quote="honeben":1y3f3v6i]does this help?

[/quote:1y3f3v6i]

Just as Tulamide pointed out that a sub condition if fine with used with Else, Trigger once is best used as a sub condition. Since it has no condition to compare it will probably run every time, which is something you want here, but for logic's sake an Always would make more sense.
Image Image
B
161
S
48
G
91
Posts: 7,358
Reputation: 67,271

Post » Wed Nov 24, 2010 9:21 am

[quote="irbis":3ktaxvz8]actualy i was just an idiot and though that if i write % mark it would (just as using your calculator) divide. forgoten this obvious fact that 10% are in fact 0.10, and to get 10% of something i need it be multiply by 0.10.[/quote:3ktaxvz8]
Don't be too harsh to yourself. It's just learning by doing, we all come to such points from time to time ;)

* off-topic *
And here a description of the modulo operation:
[list:3ktaxvz8]The percentage sign, when used outside of a string, is an operator, just like +, -, *, /, etc. And it does divide, but a modulo division, aka 'mod', giving the integer remainder of the division:
[list:3ktaxvz8]13 % 5 = 3
-> can also be expressed by: 13 - floor(13 / 5) * 5
-> you can also do ((13 / 5) - floor(13 / 5)) * 5
-> it is just returning the decimal places of the division multiplied by the denominator
[list:3ktaxvz8]13 / 5 = 2.6; 0.6 * 5 = 3[/list:u:3ktaxvz8][/list:u:3ktaxvz8]Modulo is often used in programming to get a repeating list of ordered numbers.
For example, the timer returns the milliseconds passed since start of the application. You want a sprite to constantly fade in and out repeatedly and every fade should last 1 second. But the sprite's opacity is expressed by a value ranging from 0 to 100. So what we need is converting the timer value in a way that we get a value repeatedly growing and shrinking between 0 and 100.
[list:3ktaxvz8][*:3ktaxvz8]There are 1000 milliseconds in one second, but we need one second to be 100.
[*:3ktaxvz8]If doing 'timer % 100', the results returned will raise from 0 to 99, then immediatly fall back to 0 and raise again. [0, 1, 2, ..., 98, 99, 0, 1, 2, ...][/*:m:3ktaxvz8][/list:u:3ktaxvz8]
The first issue is solved by floor-dividing timer by 10.
The second issue is solved with two other tricks. First, we set the denominator to 201. This way the values returned will range from 0 to 200. Second, we make use of 'abs', which returns the absolute value of a number regardless of its sign (-4 and 4 both have the absolute value 4)

The final expression now is: opacity = abs(100 - floor(Timer / 10) % 201)
The returned values will be [100, 99, 98, ..., 2, 1, 0, 1, 2, ..., 98, 99, 100, 99, 98, ...] and every range 0-100 or 100-0 will last 1 second[/*:m:3ktaxvz8][/list:u:3ktaxvz8]

I just thought I explain it for those who are curious beginners. If it is inappropiate, I apologize.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Wed Nov 24, 2010 9:33 am

[quote="tulamide":2y5nnt6i]
* off-topic *
And here a description of the modulo operation:
[list:2y5nnt6i]The percentage sign, when used outside of a string, is an operator, just like +, -, *, /, etc. And it does divide, but a modulo division, aka 'mod', giving the integer remainder of the division:
[list:2y5nnt6i]13 % 5 = 3
-> can also be expressed by: 13 - floor(13 / 5) * 5
-> you can also do ((13 / 5) - floor(13 / 5)) * 5
-> it is just returning the decimal places of the division multiplied by the denominator
[list:2y5nnt6i]13 / 5 = 2.6; 0.6 * 5 = 3[/list:u:2y5nnt6i][/list:u:2y5nnt6i]Modulo is often used in programming to get a repeating list of ordered numbers.
For example, the timer returns the milliseconds passed since start of the application. You want a sprite to constantly fade in and out repeatedly and every fade should last 1 second. But the sprite's opacity is expressed by a value ranging from 0 to 100. So what we need is converting the timer value in a way that we get a value repeatedly growing and shrinking between 0 and 100.
[list:2y5nnt6i][*:2y5nnt6i]There are 1000 milliseconds in one second, but we need one second to be 100.
[*:2y5nnt6i]If doing 'timer % 100', the results returned will raise from 0 to 99, then immediatly fall back to 0 and raise again. [0, 1, 2, ..., 98, 99, 0, 1, 2, ...][/*:m:2y5nnt6i][/list:u:2y5nnt6i]
The first issue is solved by floor-dividing timer by 10.
The second issue is solved with two other tricks. First, we set the denominator to 201. This way the values returned will range from 0 to 200. Second, we make use of 'abs', which returns the absolute value of a number regardless of its sign (-4 and 4 both have the absolute value 4)

The final expression now is: opacity = abs(100 - floor(Timer / 10) % 201)
The returned values will be [100, 99, 98, ..., 2, 1, 0, 1, 2, ..., 98, 99, 100, 99, 98, ...] and every range 0-100 or 100-0 will last 1 second[/*:m:2y5nnt6i][/list:u:2y5nnt6i]

I just thought I explain it for those who are curious beginners. If it is inappropiate, I apologize.[/quote:2y5nnt6i]
ImageImageImageImage
B
26
S
7
G
7
Posts: 572
Reputation: 6,097


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests