Help with Waiting for Trigger...

syberchick70
Posts: 9
Joined: Mon Jun 27, 2016 2:37 am

Help with Waiting for Trigger...

Post by syberchick70 »

So, I've been told the best way to do this is either with a timer (don't want to, not reliable) or a tempTrigger (would be a huge chain).

I'm trying to write my startup script to put my defenses up when I enter the world. There are things I have to 'wait for' before moving to the next step in the script. This used to be easy with Cmud (#waitfor) and I know there must be something similar I can do with mudlet, but just haven't been able to figure it out.

Here is an example

Trigger - enterworld text

send("barkskin")
(wait for "You have recovered equilibrium")
send("selfishness")

There is a rather long series of defenses I want to put up, so making a trigger for EACH ONE would be cumbersome. How would I do this??

azure_glass
Posts: 97
Joined: Wed Jul 25, 2012 12:35 pm

Re: Help with Waiting for Trigger...

Post by azure_glass »

If you want only to start up with triggers. Try something like that:

allias: start

tempTimer(1, send("first spell"))
tempTimer(5, send("second spell"))
tempTimer(10, send("third spell"))
tempTimer(15, send("fourth spell"))
tempTimer(20, send("fifth spell"))
tempTimer(25, send("sixth spell"))
English is not my native language. If you don't understand what im writing ask. :)
Ubuntu 17.04, Mudlet 3.1

azure_glass
Posts: 97
Joined: Wed Jul 25, 2012 12:35 pm

Re: Help with Waiting for Trigger...

Post by azure_glass »

OR

allias: Start

enableTimer("1")
enableTimer("2")
enableTimer("3")

------------------------

and set timer to XYZ seconds and:

send("cast spell 1")
disableTimer("1")
English is not my native language. If you don't understand what im writing ask. :)
Ubuntu 17.04, Mudlet 3.1

syberchick70
Posts: 9
Joined: Mon Jun 27, 2016 2:37 am

Re: Help with Waiting for Trigger...

Post by syberchick70 »

But isn't there a way to wait for a specific phrase before continuing?

It seems like the mapping script does something like that, I saw a tutorial where an alias 'pauseUntil' was made... but not sure how I could make that work for this application.

syberchick70
Posts: 9
Joined: Mon Jun 27, 2016 2:37 am

Re: Help with Waiting for Trigger...

Post by syberchick70 »

Here is the example I found for the mapping script - I don't see why I couldn't make this work for what I'm doing:

Delayed Movements
This approach can be used for things such as waiting for a ship to arrive. It depends on the exitScript function above being defined.
Alias: ^pauseUntil "(.+)" (.+)$
Usage: pauseUntil "board ship" A ship sails into port.$
Script:
setRoomUserData(roomid, "exitScript"..matches[2], "moveStop=1;tempTrigger("..matches[3]..", [[moveStop=nil;speedWalkPath = roomsToWalk;doSpeedWalk()]],true)")
The moveStop=1 causes my speedwalker to stall, the tempTrigger part triggers the action to continue walking. When a message such as "A ship sails into port" on which the direction "board ship" will be launched. Similarly the exit "disembark ship" will pause the mapper until the message indicating we've landed has been seen. Note that because we check the exitScripts BEFORE moving a direction this allows us to wait.

azure_glass
Posts: 97
Joined: Wed Jul 25, 2012 12:35 pm

Re: Help with Waiting for Trigger...

Post by azure_glass »

I just saw manual witch I barly(?) understand.

I think the best way is to check with timestamps time to events and make allias or make triggers
English is not my native language. If you don't understand what im writing ask. :)
Ubuntu 17.04, Mudlet 3.1

syberchick70
Posts: 9
Joined: Mon Jun 27, 2016 2:37 am

Re: Help with Waiting for Trigger...

Post by syberchick70 »

What if it takes longer than normal to recover equilibrium? Then my ENTIRE process is buggered.

azure_glass
Posts: 97
Joined: Wed Jul 25, 2012 12:35 pm

Re: Help with Waiting for Trigger...

Post by azure_glass »

Then maybe something like that:

First trigger
(Something)
Code:
VarOne = 1
EnableTimer(yyy)

Timer for x seconds

if VarOne == 1 then
send(cast something)
VarOne = 0
disableTimer(yyy)
end
English is not my native language. If you don't understand what im writing ask. :)
Ubuntu 17.04, Mudlet 3.1

syberchick70
Posts: 9
Joined: Mon Jun 27, 2016 2:37 am

Re: Help with Waiting for Trigger...

Post by syberchick70 »

Maybe I'm being dense here, but I can't see how that would avoid the issue of 'regaining equilibrium' taking longer than expected?

Let me give some scenarios here. Let's say I pop into the world in a hostile environment (perhaps unexpectedly hostile). During the process of trying to (automatically) put my defs up, someone does something to me that repeatedly knocks me off equilibrium, or casts (what we call) Aeon on me, which slows down everything I do. The timer is activated and tries to fire the next step (which fails because I can't do that yet) but still another timer is activated and the script moves on to the next step. It's all buggered. My only choice at that point is to turn off all of my triggers and such, which will also likely be lethal.

There MUST be a way to step through the script, or wait for a trigger, or something. I mean, this is a pretty elegant language and I can't believe they would have overlooked such a critical feature as a simple way to 'waitfor' an event. :p

azure_glass
Posts: 97
Joined: Wed Jul 25, 2012 12:35 pm

Re: Help with Waiting for Trigger...

Post by azure_glass »

I thik about that but you always can do it hard way.

Allias cast x
Enable timer 0.5 second
Enable trigger(gag)
Enable trigger(cast)

TriggerGag
You can't cast that spell yet.
Deleteline()

Castspelltrigger
You cast spell
Disabletimer()
Disabletrigger(gag)
English is not my native language. If you don't understand what im writing ask. :)
Ubuntu 17.04, Mudlet 3.1

Post Reply