Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
jackwest
Novice


Joined: 01 Jan 2009
Posts: 35

PostPosted: Thu Jan 01, 2009 3:45 pm   

#waitfor?
 
maybe easier if i just show the code and the result

Code:
#t- "Connected to host ****"
#echo "login detection disabled"
quit
#echo "quitting"
#WAITFOR {Leaving **** for the 'real world'...} 5000
#echo "confirmation from mud recieved"
#connect
#echo "new connection attempted"
#waitfor {Connected to host ****} 5000
#echo "connection confirmed"
login
password
#class /alt_list/@character_name 1|disable
#class /alt_list/@character_name 1
#wait 500
#SENDP %char(10)
#t+ "Connected to host ****"


and the output

Code:
login detection disabled
quit
quitting
confirmation from mud recieved
new connection attempted
connection confirmed
login
password
Leaving **** for the 'real world'...


basically, #waitfor isnt waiting... have i missed something? my script is spewing out everything before the first #waitfor condition is even met.


Last edited by jackwest on Thu Jan 01, 2009 6:21 pm; edited 1 time in total
Reply with quote
Qaiia
Wanderer


Joined: 06 Apr 2007
Posts: 59

PostPosted: Thu Jan 01, 2009 5:44 pm   
 
Yes, you need to enclose the events to occur after the #WAITFOR in {brackets}. First set of brackets is commands to perform when the condition is met, the second set is for when the condition isn't met.

Code:
Syntax: #WAITFOR {pattern} timeout {match-commands} {timeout-commands}


Code:
#t- "Connected to host ****"
#echo "login detection disabled"
quit
#echo "quitting"
#WAITFOR {Leaving **** for the 'real world'...} 5000 {
#echo "confirmation from mud recieved"
#connect
#echo "new connection attempted"
#waitfor {Connected to host ****} 5000
#echo "connection confirmed"
login
password
#class /alt_list/@character_name 1|disable
#class /alt_list/@character_name 1
#wait 500
#SENDP %char(10)
#t+ "Connected to host ****"
}
_________________
Citrus: The Juicy Alternative
Reply with quote
jackwest
Novice


Joined: 01 Jan 2009
Posts: 35

PostPosted: Thu Jan 01, 2009 6:20 pm   
 
thanks wanderer, unfortunately i still cant get it to work

to simplify matters i'm now using just the first #waitfor

Code:
quit
#waitfor {^Leaving for the 'real world'...} 5000 {#connect;#echo yes} {#connect;#echo no}


which should in theory means it should connect whether it triggers or not. but nothing happens at all, it disconnects and just sits there.

i was thinking that maybe the triggering condition was happening too quickly and the #waitfor was initialising after the confirmation had already been sent... but in this case it should still reconnect after 5 seconds. it may be possible that the act of disconnecting is interrupting the #waitfor, it's the only thing i can think of at the moment.

suggestions anyone?

edit: i found tags :-)
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Jan 05, 2009 7:04 pm   
 
If the MUD is disconnecting you, then yes, your #WAITFOR script is going to be aborted and will never run. When the MUD disconnects a session, all outstanding scripts/threads are terminated to prevent crashes when they try to access a non-existent connection.

What you are trying to do is create an auto-reconnect trigger. Many MUDs forbid that kind of scripting. Even CMUD itself has limited auto-reconnect abilities because if CMUD always tried to continuously reconnect a session, many MUDs would ban it. (CMUD only tries 20 times, with a minimum time between retries).

In other words, CMUD should already attempt to auto-reconnect you in most situations. If you are trying to get around that behavior, it's going to be difficult. You won't be able to maintain a #WAITFOR script in any of those cases...you should look into using the OnConnect and OnDisconnect event triggers instead. Just be sure you aren't doing something that the MUD is going to ban you for.
Reply with quote
jackwest
Novice


Joined: 01 Jan 2009
Posts: 35

PostPosted: Thu Jan 08, 2009 11:36 pm   
 
My mud bans auto-reconnects. What I was trying to do was bind character logins to buttons along the top of the screen. I shift a lot between alts and even relog a character during combat regularly to ensure correct priorities. Clicking a button would speed that up significantly.

Thanks for the reply. I'll have a look into onconnect and ondisconnect.

Jack.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
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

© 2009 Zugg Software. Hosted by Wolfpaw.net