wait states

Posted by Ithildin on Wed 15 Sep 2004 07:37 AM — 8 posts, 27,579 views.

USA #0
When my players quit, I want them to have a little bit of a wait time because they are setting up camp. this also allows if they have a mob hunting them, they can't just log off for awhile. nothing too long, but still need it. i couldn't get this wait state to work. it never did anything. anyone know what i'm doing wrong?



send_to_char ("^CYou search around for a safe place to camp.^w\n\r", ch);
WAIT_STATE( ch, 4 * PULSE_TICK);
send_to_char ("^GYou complete your campsite.^w\n\r", ch);


i've also tried this to see if anything was working:


WAIT_STATE( ch, 3000 );

        send_to_char ("^CYou search around for a safe place to camp.^w\n\r", ch);
WAIT_STATE( ch, 4 * PULSE_VIOLENCE);
send_to_char ("^GYou complete your campsite.^w\n\r", ch);
[/CODE]

any thoughts?


USA #1
The wait state is a command delay, not a time delay. You need to use the timer delay to do what you want. I think there are some topics on it, see if you can find any while I look up the code for timer delay.
USA #2
hmm..i'm workin on envy, it doesn't have a timer build in to it. it's in a command do_camp. here is a piece of code in do_search.


 if (!found)
    {
      buf2[0] = '\0';
      WAIT_STATE (ch, 2 * PULSE_VIOLENCE);
      strcat (buf2, "Your search reveals nothing.\n\r");
      send_to_char (buf2, ch);
    }


would i hvae to add a timer state to the whole mud itself to make the timer here? or can i work a wait state into it?
USA #3
Can you post the full search function? Smaug's WAIT_STATE adds a "lag" to the player, not a timer.
USA #4
Yeah. The wait state simply delays processing of *future* commands, not ones that have already been processed e.g. your quit command. It is completely useless for what you are trying to do.

How can your SMAUG not have a timer in it? That's how search works - it sets the substate and calls another search later on.
USA #5
Ksilyan,

i'm on an envy codebase. i just recently got the new coder position on a mud. it's differnt from smaug, but kind of the same. i can't find a good envy forum, so i'm thinking of trying to add a timer function into envy from smaug. port one over. or if there are any quick fixes for right now. i don't know, i'll have to look into it more.
USA #6
OK - how do they implement the search function then?

Their syntax looks like it was taken from SMAUG so chances are they built on top of SMAUG - which would mean that they'd still have those timers since those have been around for a long time.
USA #7
i'll get the code once i get off work, but envy was based off of merc, so envy is kind of like an old VW bug compared to smaug. This mud im workin on is about 7 years old and based on envy20. so some things are the same, but mostly smaug is alot more user friendly. i'll get the search function once i get home though.