Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Another idea to loop?/repeat [Delphi]

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Kevin
Grandmaster Cheater Supreme
Reputation: 0

Joined: 07 Mar 2007
Posts: 1139
Location: Spiderman-World

PostPosted: Sun Jul 22, 2007 7:34 am    Post subject: Another idea to loop?/repeat [Delphi] Reply with quote

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
View user's profile Send private message MSN Messenger
UnLmtD
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Sun Jul 22, 2007 7:39 am    Post subject: Reply with quote

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
View user's profile Send private message
Kevin
Grandmaster Cheater Supreme
Reputation: 0

Joined: 07 Mar 2007
Posts: 1139
Location: Spiderman-World

PostPosted: Sun Jul 22, 2007 7:44 am    Post subject: Reply with quote

(wasnt your name zomgiown?)

im trying to call the procedure auto, 100 times yes and then stop.
Back to top
View user's profile Send private message MSN Messenger
UnLmtD
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Sun Jul 22, 2007 7:54 am    Post subject: Reply with quote

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
View user's profile Send private message
Kevin
Grandmaster Cheater Supreme
Reputation: 0

Joined: 07 Mar 2007
Posts: 1139
Location: Spiderman-World

PostPosted: Sun Jul 22, 2007 7:57 am    Post subject: Reply with quote

yes was thinking about that... but since im on a computer without delphi right now i couldn't test it.
Back to top
View user's profile Send private message MSN Messenger
KingZero
Expert Cheater
Reputation: 0

Joined: 27 Jun 2006
Posts: 103

PostPosted: Sun Jul 22, 2007 11:05 am    Post subject: Reply with quote

Code:

var i:integer;
begin
i:=1;
repeat
your code
inc(i);
until i=100;
Back to top
View user's profile Send private message
Kevin
Grandmaster Cheater Supreme
Reputation: 0

Joined: 07 Mar 2007
Posts: 1139
Location: Spiderman-World

PostPosted: Sun Jul 22, 2007 11:26 am    Post subject: Reply with quote

ok but the other code works good ...
Back to top
View user's profile Send private message MSN Messenger
magicalimp
Expert Cheater
Reputation: 0

Joined: 03 Dec 2006
Posts: 105

PostPosted: Sun Jul 22, 2007 2:07 pm    Post subject: Reply with quote

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
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25820
Location: The netherlands

PostPosted: Sun Jul 22, 2007 6:27 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
DeltaFlyer
Grandmaster Cheater
Reputation: 0

Joined: 22 Jul 2006
Posts: 666

PostPosted: Sun Jul 22, 2007 7:21 pm    Post subject: Reply with quote

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
View user's profile Send private message
magicalimp
Expert Cheater
Reputation: 0

Joined: 03 Dec 2006
Posts: 105

PostPosted: Sun Jul 22, 2007 7:52 pm    Post subject: Reply with quote

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. Very Happy
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Sun Jul 22, 2007 8:06 pm    Post subject: Reply with quote

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
View user's profile Send private message
magicalimp
Expert Cheater
Reputation: 0

Joined: 03 Dec 2006
Posts: 105

PostPosted: Sun Jul 22, 2007 8:31 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites