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
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:
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.
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.
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!
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!
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)