View previous topic :: View next topic |
Author |
Message |
Machu Righter, a person who rights wrongs

Joined: 09 Jul 2003 Posts: 737
|
Posted: Thu Jun 10, 2004 5:26 pm Post subject: How does autonumber work? |
|
|
Okay, here's some psuedo-code; tell me how this will work out:
Code: |
main script,begin
while (true),begin
loopy1
loopy2
turn off tag2
turn off tag3
wait
end
end
loopy1,begin
while(tag2 is off),begin
stuff
a certain keypress might turn tag2 on
wait
end
end
loopy2,begin
while(tag3 is off),begin
stuff
a certain keypress might turn tag3 on
wait
end
end
|
So, will it:
A. run loopy1's while-loop until the keypress turns tag2 on, then do the same with loopy2, then repeat.
or B. run both loopy1 and loopy2 simultaneously every tick, in which "stuff" will constantly trigger (thus making this script worthless or even overflow).
Most programing languages would do A, but there's something crazy I noticed about plotscripting which would make sense if it were case B. If it is case B, does that mean that running another method/autonumber script will run that script and continue, even if the autonumber script has waits or a while-loop? _________________
Code: | [*]That's it
[*]I'm done reasoning with you
[*]Starting now, there's going to be a lot less conversation and a lot more killing |
|
|
Back to top |
|
 |
MultiColoredWizard Come back, baby! The Breastmaster

Joined: 01 Feb 2003 Posts: 1232
|
Posted: Thu Jun 10, 2004 5:46 pm Post subject: |
|
|
A, of course.
I think plotscripting waits for nested loops to finish first. |
|
Back to top |
|
 |
Dan the Man Entertainment
Joined: 31 May 2003 Posts: 204
|
Posted: Thu Jun 10, 2004 6:04 pm Post subject: |
|
|
The while command doesn't work with Begin
You'll have to do it like this
Code: |
loopy1,begin
while(tag2 is off) do
(
stuff
a certain keypress might turn tag2 on
wait
)
end
|
And when it comes to doing things like that, you should use
if instead of while since there's already a while in the main
loop script. |
|
Back to top |
|
 |
Machu Righter, a person who rights wrongs

Joined: 09 Jul 2003 Posts: 737
|
Posted: Thu Jun 10, 2004 6:12 pm Post subject: |
|
|
The idea behind putting a while-loop inside of another is that the "stuff" in loopy1 is supposed to constantly trigger until tag2 is on, then the "stuff" in loopy2 will constantly trigger, and after tag3 is on, we go back to loopy1.
Well, I hope MCW is right, but I'll backup my script just-in-case. _________________
Code: | [*]That's it
[*]I'm done reasoning with you
[*]Starting now, there's going to be a lot less conversation and a lot more killing |
|
|
Back to top |
|
 |
JSH357

Joined: 02 Feb 2003 Posts: 1705
|
Posted: Thu Jun 10, 2004 6:24 pm Post subject: |
|
|
Dan: In Hamsterspeak, begin and ( are synonyms. You never even have to type 'begin' if you don't want to. |
|
Back to top |
|
 |
MultiColoredWizard Come back, baby! The Breastmaster

Joined: 01 Feb 2003 Posts: 1232
|
Posted: Thu Jun 10, 2004 6:44 pm Post subject: |
|
|
dan, it's called pseudo code, so of course it's not right.
and jsh, he meant he used while(ds)begin(shit)
it's while(si)do(shit) |
|
Back to top |
|
 |
JSH357

Joined: 02 Feb 2003 Posts: 1705
|
Posted: Thu Jun 10, 2004 7:29 pm Post subject: |
|
|
oh.. you thought I read the rest of the post? :p
My mistake though; I haven't done any plotscripting in a while. |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Thu Jun 10, 2004 9:03 pm Post subject: |
|
|
A is the right one.
The plotscript interpreter only ever runs one script at a time, the active script on top of the script heap. When the script finishs, the interpreter gos to next one down, if a script is loaded the active one is paused and the new one put on top of the 'heap'. If you stick a while loop in one of the called scripts, it'll stay on that script until its finished.
Wait commands cause the interpreter to pause the script, and game.exe does other stuff until it gets back to interpreting.
Your pseudo code looks fine. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
Machu Righter, a person who rights wrongs

Joined: 09 Jul 2003 Posts: 737
|
Posted: Thu Jun 10, 2004 9:26 pm Post subject: |
|
|
Ah. I guess whatever the problem I saw was caused by something else. Thanks for the help, everyone. _________________
Code: | [*]That's it
[*]I'm done reasoning with you
[*]Starting now, there's going to be a lot less conversation and a lot more killing |
|
|
Back to top |
|
 |
|