Browse Search Popular Register Upload Rules User list Login:
Search:
HELP!!

Image:
screenshot of the scene

Author: faytree

Group: Default

Filesize: 7.58 kB

Date added: 2013-06-06

Rating: 4.5

Downloads: 748

Views: 401

Comments: 11

Ratings: 2

Times favored: 0

Made with: Algodoo before v1.8.5

Tags:

Scene tag

wat on the fuks is happening!
Please log in to rate this scene
edit
Your script is what's wrong. It states, "If 2, then make it 3" which causes the result to be 3. Then when the result changes to 3, the script states, "If 3, then make it 4", etc. So, the result jumps from 1 to 5 very quickly without pressing the appropriate key. You need to change the script so that only ONE action occurs with each key press. I won't tell you how to do it because you will learn better if you have to figure it out for yourself. ;)

By the way, please do not use profanity in your comments or in your scenes. Thanks
Last edited at 2013/06/06 15:59:01 by Xray
XRay, I don't think thats the case since when changing the script to use a numerical value, rather than text, it works fine without editing it to make it only run once.

Either way, faytree using a numerical value works fine, I guess you could work it out from there:)
MrGlinzz - I don't know how you changed the script, but when I changed from text to a numerical value, the scene works exactly like it did before. That is, it skips from 1 to 5, and from 5 to 1, which is just as I expected it to.

Here is a copy of my test script from the right arrow:

onClick = (e)=>{
scene.my.page == 1 ? {
scene.my.page = 2
} : {};
scene.my.page == 2 ? {
scene.my.page = 3
} : {};
scene.my.page == 3 ? {
scene.my.page = 4
} : {};
scene.my.page == 4 ? {
scene.my.page = 5
} : {}
}

Also, in the black box with the text, you need to change it to:

text = {"Page " + scene.my.page }
Last edited at 2013/06/06 20:58:55 by Xray
Heres mine:

(e)=>{
scene.my.page >= 5 ? {
scene.my.page = 5
} : {
scene.my.page = scene.my.page + 1
}
}

For the other arrow:

(e)=>{
scene.my.page <= 1 ? {
scene.my.page = 1
} : {
scene.my.page = scene.my.page - 1
}
}

And the same as what you've done with the text.

I understand where you're coming from, just seems that "click" wouldn't loop, since when you hold your mouse button it doesn't spam. Course this is down to interpretation.
Last edited at 2013/06/06 22:09:46 by MrGlinzz
Mrglinzz - You've completely changed the way the script works from Faytree's original algorithm, and that's why yours works. That's what I was eluding to when I told Faytree what he needed to do to make it work.
Hm, how comes mine doesn't jump from 1 to 5 then? It's essentially the same?
I would have to see the code.

EDIT - If your code, that you say is "essentially the same", is the code that you wrote shown above, then no, it is not essentially the same. It gives the intended result, but it operates on the data differently than the original code. The test code that I wrote is essentially the same as Faytree's.

Your code is the way Faytree should have written it! :tup:
Last edited at 2013/06/07 17:40:20 by Xray
Yes but my code still require for a value to change when pressed, and if faytrees jumps from 1 through to 5 very quickly why shouldn't mine? Just wanna get my head round this! :bonk:
Because ALL of the lines of code get executed for each click of the mouse. When your code gets executed, the only line that increments a value is: scene.my.page = scene.my.page + 1 So, the code increments only one time. In Faytree's code, each step (all 5) gets incremented, and it happens so fast that it appears to jump from 1 to 5. Make sense?
My way(that does not edit faytree's script) is to make a variable called _confirmation, that is enabled by postStep, and the code of onClick will be executed if _confirmation is true. postStep will make it false(duh why I said that)
Oh I see! Haha thanks for clearing that up! I'll remember that in the future:)
Thanks XRay!