TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

Frustration with #delay

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Script Help
View previous topic :: View next topic  
Author Message
Darth Gnome



Joined: 19 May 2016
Posts: 1

PostPosted: Thu May 19, 2016 10:38 am    Post subject: Frustration with #delay Reply with quote

Hi,

I'm trying to make a simple count down method, and encountered all sorts of problems with the #delay method. I'm not sure if this is me trying to do something incorrectly, or if there is just unexpected behavior with #delay.

Example 1: Hard Code the count down.
No looping, nothing fancy, just a bunch of showme's in delays:

Code:
#alias {hrun} {#delay {1} {#showme 5};#delay {1} {#showme 4};#delay {1} {#showme 3};#delay {1} {#showme 2};#delay {1} {#showme 1}}


Result:
Delays the first showme, then the rest spam in undelayed at all.

Example 2: Loop from 5 to 1
Code:
#alias {hrun} {#loop 5 1 cnt {#delay {1} {#showme $cnt}}


Result:
Delays once, displays this:
Quote:

1
1
1
1
1
Pardon?

<long delay here>

Pardon?

Pardon?

Pardon?

Pardon?



Any help would be.... helpful! Thanks
Back to top
View user's profile Send private message
PowerGod



Joined: 04 Aug 2014
Posts: 339

PostPosted: Thu May 19, 2016 11:18 pm    Post subject: Reply with quote

When you launch a #delay, the next commands are executed immediately, only the commands inside that delay are actually "delayed".

So, your first example should be changed this way:

Code:

... #delay {1} {#showme 5}; #delay {2} {#showme 4}; #delay {3} {#showme 3}; etc...


Note that the second delay has "2" seconds, because it is initialized almost at the same time of the previous one, same story for the third delay, etc...

Anyway, for something like this you could use a #ticker

Code:

#var counter 5

#ticker {countdown} {
     #echo $counter;
     #math {counter} {$counter-1};
     #if {$counter==-1} {#untick {countdown}}
} {1}


This code will show a number every second until it reaches 0, then it will destroy itself
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Script Help All times are GMT - 5 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
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group