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 


[Help] Making a loop\repeat on Delphi

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

Joined: 10 May 2007
Posts: 624
Location: Delete C:\WINDOWS folder and you'll be able to see me.

PostPosted: Wed Jul 04, 2007 2:20 am    Post subject: [Help] Making a loop\repeat on Delphi Reply with quote

How can I make a loop\repeat on Delphi?
Thx.

_________________
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
Simsgy
Grandmaster Cheater
Reputation: 0

Joined: 07 May 2007
Posts: 581
Location: My new avatar <3

PostPosted: Wed Jul 04, 2007 4:18 am    Post subject: Reply with quote

Use a Timer.
Make it usualy enabled := false, but when you want to active the loop, do Timer.Enabled := True.
Double click on the timer, and enter what ever you want it to do, and in the timer interval, enter the milliseconds between his loops.

_________________

Designer, WebMaster and a Delphi programmer.
TrPlayer, my biggest Delphi project hosted on SourceForge.net
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Uzeil
Moderator
Reputation: 6

Joined: 21 Oct 2006
Posts: 2411

PostPosted: Wed Jul 04, 2007 5:56 am    Post subject: Reply with quote

Code:
var i: dword;
begin
  for i:=0 to 10 do
   showmessage('For Loop: Currently on number '+IntToStr(i));

  while i>0 do
  begin
    dec(i);
    showmessage('While Loop:  Currently on number '+IntToStr(i));
  end;

  Repeat
    inc(i);
    showmessage('Repear Loop:  Currently on number '+IntToStr(i));
  Until
    i=10;
end;


Should all work. I may be wrong on the Until keyword, but I'm relatively certain.

_________________


Mini Engine v3.0
Mipla v1.0

Reposted old threads out of the MS section.
Back to top
View user's profile Send private message
Simsgy
Grandmaster Cheater
Reputation: 0

Joined: 07 May 2007
Posts: 581
Location: My new avatar <3

PostPosted: Wed Jul 04, 2007 8:18 am    Post subject: Reply with quote

Uzeil wrote:
Code:
var i: dword;
begin
  for i:=0 to 10 do
   showmessage('For Loop: Currently on number '+IntToStr(i));

  while i>0 do
  begin
    dec(i);
    showmessage('While Loop:  Currently on number '+IntToStr(i));
  end;

  Repeat
    inc(i);
    showmessage('Repear Loop:  Currently on number '+IntToStr(i));
  Until
    i=10;
end;


Should all work. I may be wrong on the Until keyword, but I'm relatively certain.


Why messing up?
Using a timer is much more easy.

_________________

Designer, WebMaster and a Delphi programmer.
TrPlayer, my biggest Delphi project hosted on SourceForge.net
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
UnLmtD
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Wed Jul 04, 2007 8:26 am    Post subject: Reply with quote

Because he asked for a loop and its better to use for,while then using a timer.
_________________
Back to top
View user's profile Send private message
Simsgy
Grandmaster Cheater
Reputation: 0

Joined: 07 May 2007
Posts: 581
Location: My new avatar <3

PostPosted: Wed Jul 04, 2007 8:30 am    Post subject: Reply with quote

Isn't it the same (I'm not saying I didn't use for in my SimsAC)?
_________________

Designer, WebMaster and a Delphi programmer.
TrPlayer, my biggest Delphi project hosted on SourceForge.net
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
UnLmtD
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Wed Jul 04, 2007 8:44 am    Post subject: Reply with quote

I have never seen a timer being used as a loop in any example, source code, documentation. (As long as I remember)

And using for loop is easy and it works great,
Code:
int i;

for(i=0;i<5;i++)
{
   // loop body here....
}


Loops five times, how would you do that with a timer? Even if it's possible, it's not the best thing to do.

_________________
Back to top
View user's profile Send private message
Simsgy
Grandmaster Cheater
Reputation: 0

Joined: 07 May 2007
Posts: 581
Location: My new avatar <3

PostPosted: Wed Jul 04, 2007 9:15 am    Post subject: Reply with quote

Oh!
You was talking on an timer with an end.
I was talking on an endless timer.

_________________

Designer, WebMaster and a Delphi programmer.
TrPlayer, my biggest Delphi project hosted on SourceForge.net
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
UnLmtD
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Wed Jul 04, 2007 9:26 am    Post subject: Reply with quote

for (;Wink
{

}

Endless loop.

_________________
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Wed Jul 04, 2007 9:52 am    Post subject: Reply with quote

zomgiownyou wrote:
for (;;)
{

}

Endless loop.


you can't do that with delphi (unless you use GOTO, which might confuse people), always has to be some kind of logical statement :(
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