| View previous topic :: View next topic |
| Author |
Message |
Kevin Grandmaster Cheater Supreme
Reputation: 0
Joined: 07 Mar 2007 Posts: 1139 Location: Spiderman-World
|
Posted: Sun Jul 22, 2007 7:34 am Post subject: Another idea to loop?/repeat [Delphi] |
|
|
Hi again, I've not been very active the last few days because i've been working on a bot for this site im member on (my account got banned, so had to use a few hours getting high post count, post count equals in points and when high enough points your might able to win something)
So i made a procedure i called Auto (the bot, using SetCursPos and simulating mouseclick and SendInput (so it enters text))
So isnt it possible to do something like this:
Procedure Button1Click ...
begin
//Script that makes the auto procedure go 100 times, without writing Auto; 100 times. Is this possible?
end;
thanks in advance, also i migth not be as active as i was before. Im pretty busy in real life, just so you know. |
|
| Back to top |
|
 |
UnLmtD Grandmaster Cheater
Reputation: 0
Joined: 13 Mar 2007 Posts: 894 Location: Canada
|
Posted: Sun Jul 22, 2007 7:39 am Post subject: |
|
|
If I'm getting this right, you are trying to call the Auto procedure 100 times and then stop? If so a for loop will work. _________________
|
|
| Back to top |
|
 |
Kevin Grandmaster Cheater Supreme
Reputation: 0
Joined: 07 Mar 2007 Posts: 1139 Location: Spiderman-World
|
Posted: Sun Jul 22, 2007 7:44 am Post subject: |
|
|
(wasnt your name zomgiown?)
im trying to call the procedure auto, 100 times yes and then stop. |
|
| Back to top |
|
 |
UnLmtD Grandmaster Cheater
Reputation: 0
Joined: 13 Mar 2007 Posts: 894 Location: Canada
|
Posted: Sun Jul 22, 2007 7:54 am Post subject: |
|
|
Yes, it got changed =)
Okay well a procedure is like function right?
Umm in C it will look like this:
| Code: | int x;
for ( x = 0; x < 100; x++ )
{
MyFunction()
}
|
Wait up, going to try to get a Delphi code.
Umm well lets try
| Code: | var x: integer;
begin
for x := 0 to 100 do
begin
//Call your function here
end;
end; |
_________________
|
|
| Back to top |
|
 |
Kevin Grandmaster Cheater Supreme
Reputation: 0
Joined: 07 Mar 2007 Posts: 1139 Location: Spiderman-World
|
Posted: Sun Jul 22, 2007 7:57 am Post subject: |
|
|
| yes was thinking about that... but since im on a computer without delphi right now i couldn't test it. |
|
| Back to top |
|
 |
KingZero Expert Cheater
Reputation: 0
Joined: 27 Jun 2006 Posts: 103
|
Posted: Sun Jul 22, 2007 11:05 am Post subject: |
|
|
| Code: |
var i:integer;
begin
i:=1;
repeat
your code
inc(i);
until i=100;
|
|
|
| Back to top |
|
 |
Kevin Grandmaster Cheater Supreme
Reputation: 0
Joined: 07 Mar 2007 Posts: 1139 Location: Spiderman-World
|
Posted: Sun Jul 22, 2007 11:26 am Post subject: |
|
|
| ok but the other code works good ... |
|
| Back to top |
|
 |
magicalimp Expert Cheater
Reputation: 0
Joined: 03 Dec 2006 Posts: 105
|
Posted: Sun Jul 22, 2007 2:07 pm Post subject: |
|
|
| If you have a set number number of repetitions use a for statement. If you have a conditional end to a loop, use while do, or repeat until. |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25820 Location: The netherlands
|
Posted: Sun Jul 22, 2007 6:27 pm Post subject: |
|
|
UnLmtD, your code should be for x:=0 to 99
and what I havn't seen anyone mention yet, why not a recursive function loop?
| Code: |
function bla(nr: integer):integer;
begin
if nr>0 then
begin
myfunction;
bla(nr-1);
end;
end;
|
(recursive functions are fun)
of course, there's a limit to the ammount of times it can go, but still, it's 'a' way to do a loop _________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
DeltaFlyer Grandmaster Cheater
Reputation: 0
Joined: 22 Jul 2006 Posts: 666
|
Posted: Sun Jul 22, 2007 7:21 pm Post subject: |
|
|
Recursive functions are fun until your stack gets killed... which is very annoying if it happened because the exit condition was misplaced... _________________
Wow.... still working at 827... what's INCA thinking?
zomg l33t hax at this place (IE only). Over 150 people have used it, what are YOU waiting for? |
|
| Back to top |
|
 |
magicalimp Expert Cheater
Reputation: 0
Joined: 03 Dec 2006 Posts: 105
|
Posted: Sun Jul 22, 2007 7:52 pm Post subject: |
|
|
| Dark Byte wrote: | UnLmtD, your code should be for x:=0 to 99
and what I havn't seen anyone mention yet, why not a recursive function loop?
| Code: |
function bla(nr: integer):integer;
begin
if nr>0 then
begin
myfunction;
bla(nr-1);
end;
end;
|
(recursive functions are fun)
of course, there's a limit to the ammount of times it can go, but still, it's 'a' way to do a loop |
No one mentioned labels and gotos either.  |
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Sun Jul 22, 2007 8:06 pm Post subject: |
|
|
| gotos are ugly and disrupt the flow of programming when something can be easily done with loops. the only exception is when you consistently use "GOTO"s (asm) |
|
| Back to top |
|
 |
magicalimp Expert Cheater
Reputation: 0
Joined: 03 Dec 2006 Posts: 105
|
Posted: Sun Jul 22, 2007 8:31 pm Post subject: |
|
|
| appalsap wrote: | | gotos are ugly and disrupt the flow of programming when something can be easily done with loops. the only exception is when you consistently use "GOTO"s (asm) |
That's why they weren't mentioned... I was joking -.-;; |
|
| Back to top |
|
 |
|