View Full Version : while ... do help
Caesar
02-27-2007, 12:59 AM
Well i am trying to write a script (i'm pretty new but not the newest :-P) and I came across the While ('THIS') Do arguement and was having trouble setting it up for a script that I am working on. I was woundering how I could get it to DO while ('Chopping') . I don't know how to set the state of chopping up... I have ideas but i would like to be shure :-P. Well help if you feel like it (i'll be looking for how to)
Hey321
02-27-2007, 01:11 AM
Make Chopping a boolean, and the do
While(Chopping)Do
FTWait(4);
Searches for randoms as long and Chopping is true ;).
Avaphi
02-27-2007, 01:18 AM
Setup up a function that is called Chopping and have it return a boolean ;)
omgh4x0rz
02-27-2007, 01:55 AM
set up the boolean like this
function chopping:boolean;
begin
code...blahblah
if (something=true) then
Result:=True;
else
Result:=false;
end;
procedure DoOtherStuff;
begin
while (Chopping=True) do
FTWait(4)
end;
YoHoJo
02-27-2007, 02:06 AM
Function Chopping:Boolean; //Return True or False value
Begin
If IsUpText('Chop') Then // If the top left text is Chop
Result:=True // Return a true value
end;
Procedure WaitWhilstChopping;
var j:Integer;
Begin
While (Copping) and J<20 Do // While Chopping returns true
Begin
FindNormalRandoms //Look for randoms
Antiban //Do antiban stuff
Wait(100+Random(200)) //Wait
J:=J+1 //Counter
end;
End;
This should do it. Just edit it to your needs.
I added the J counter as a failsafe in case something goes wrong
If the wile do loop repeats over 20 times, it will stop and continue with the rest of the script.
=)
You guys are too judgmental.
This guy is new to scripting and needs specific examples.
He proly doesn't even know what a boolean is! (rofl)
:p
Love,
Yohojo
Caesar
02-27-2007, 02:13 AM
Wow thanks to all of you for spending your time helping me :-) (especially yohojo8 and omgh4x0rz) Hopefully in the future i can return the favor :-P
Junior
02-27-2007, 02:29 AM
Or instead of making a integer and adding 1 to it, you can set a time mark. Like this.
Procedure WaitWhilstChopping;
var j:Integer;
Begin
MarkTime(j);
While (Copping) Do // While Chopping returns true
Begin
FindNormalRandoms //Look for randoms
Antiban //Do antiban stuff
Wait(100+Random(200)) //Wait
if (TimeFromMark(j) > 20000) then break; //Counter
end;
End;
Caesar
02-27-2007, 02:34 AM
Or instead of making a integer and adding 1 to it, you can set a time mark. Like this.
Interresting thanks :-P
omgh4x0rz
02-27-2007, 03:15 AM
Interresting thanks :-P
Yea, remember that. The J counter yohojo showed you will work for this example, but the MarkTime(J) will become more useful once you start making scripts that need do things after a certain amount of time, e.g. logging out players.
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.