Auto searching script...

Share your scripts and packages with other Mudlet users.
Post Reply
Vooku
Posts: 72
Joined: Sun Aug 21, 2016 2:42 pm

Auto searching script...

Post by Vooku »

I want to make a small script that will start on a trigger and search until I either find something or a new message comes up that will disable the search.

How would I go about doing this?

So... "XXXX is DEAD!" would start this search function. A message of "you didn't find anything" would send another search corpse and a message of "there is nothing to find" would disable this function.

Thanks!

Nyyrazzilyss
Posts: 334
Joined: Thu Mar 05, 2015 2:53 am

Re: Auto searching script...

Post by Nyyrazzilyss »

You want a search command to initiate when something dies, repeat on fail, and end on alternate message. Since the alternate message also means the fail message (that would have resent the search command) wouldn't have been received, you can ignore it.


trigger: XXXX is DEAD!
send("search corpse")

trigger: You didn't find anything.
send("search corpse")

Vooku
Posts: 72
Joined: Sun Aug 21, 2016 2:42 pm

Re: Auto searching script...

Post by Vooku »

Nyyrazzilyss wrote:You want a search command to initiate when something dies, repeat on fail, and end on alternate message. Since the alternate message also means the fail message (that would have resent the search command) wouldn't have been received, you can ignore it.


trigger: XXXX is DEAD!
send("search corpse")

trigger: You didn't find anything.
send("search corpse")
I think I would want it as a function if I were to insert into a train script, right?

Nyyrazzilyss
Posts: 334
Joined: Thu Mar 05, 2015 2:53 am

Re: Auto searching script...

Post by Nyyrazzilyss »

A function is a section of code that's going to be called multiple times from different locations. There's no reason to make this a function. For that matter, since the body of the trigger is going to be identical for either trigger, it could be combined to a single trigger listing both patterns. In the existing code, you'd also want to insert enableTrigger and disableTrigger commands for when you want the trigger running.

Post Reply