I know the basics of a loop, such as every "repeat;" must have an until() and where to put them. If I want to make a loop continue until I press, say, the X letter key, then what would I put in the Until()?
I know the basics of a loop, such as every "repeat;" must have an until() and where to put them. If I want to make a loop continue until I press, say, the X letter key, then what would I put in the Until()?
~Zeek
Last major script: November 2009
Attempted to rejoin: January 2011
Rejoining: [][][][][]
Current task: writing basic alching script
hmmm try
EDIT: Yep, that works, just checked it.Code:repeat //Code Here until IsKeyDown('x')
Last edited by superbatman; 03-28-2009 at 07:33 PM.
[offtopic]Superbatman, try using [scar ] tags, they are nicer to read![]()
Writing an SRL Member Application | [Updated] Pascal Scripting Statements
My GitHub
Progress Report:13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you have serious physchological problems 13:46 <@BenLand100> HE GETS IT! 13:46 <@BenLand100> HE FINALLY GETS IT!!!!1
Okay, thanks!
~Zeek
Last major script: November 2009
Attempted to rejoin: January 2011
Rejoining: [][][][][]
Current task: writing basic alching script
Oo thanks nava. I used to push the little tractor icon in the corner, but its gone now![]()
Okay, so it doesn't stop at the Until(), it loops over and over again...
Here's me using it in a simple script...
SCAR Code:program New;
begin
repeat
WriteLn('Press X to make me stop appearing');
Wait(2500+random(500));
until IsKeyDown('X')
end.
And here's my result:
I made it stop with Ctrl-F4... Whenever I hit X it just types it into the script area.Code:Successfully compiled (46 ms) Press X to make me stop appearing Press X to make me stop appearing Press X to make me stop appearing Press X to make me stop appearing Press X to make me stop appearing Press X to make me stop appearing Successfully executed
~Zeek
Last major script: November 2009
Attempted to rejoin: January 2011
Rejoining: [][][][][]
Current task: writing basic alching script
Your script can only check if X is pressed everytime is reaches that point. While waiting it won't check if X is pressed.
That means you have to hold down the X button in a couple of seconds.
Just what i wanted to say.. D:Your script can only check if X is pressed everytime is reaches that point. While waiting it won't check if X is pressed.
That means you have to hold down the X button in a couple of seconds.
But, here's an easier way to do it:
Code:program New; begin while not IsKeyDown('X') do//While the 'X' key is not pressed Wait(50);//It will wait. end.
Woot woot.
Ah! Epiphany.
Thanks, all.
~Zeek
Last major script: November 2009
Attempted to rejoin: January 2011
Rejoining: [][][][][]
Current task: writing basic alching script
There are currently 1 users browsing this thread. (0 members and 1 guests)