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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
McGravin
Beginner


Joined: 30 May 2002
Posts: 25
Location: USA

PostPosted: Thu Dec 19, 2002 9:54 pm   

Alerts for a variety of messages...
 
The MOO I play will output to me a line telling me the approximate contents of a sector of space, and I want to be able to extract only certain items from a list of possible contents and have an alert based on that. However, my choice of which items I want it to alert me on can vary.

To give you an idea of the range of trigger lines I'm trying to capture from, the output looks like one of the following, depending on the actual contents:
The computer reports the presence of an asteroid.

The computer reports the presence of some debris and a star.
The computer reports the presence of some debris, an asteroid, and an artifact.


Sometimes I only want to be alerted to, say, artifacts. Other times I want to be alerted to, maybe, both artifacts and asteroids.

Here's how I was planning on going about it, but I need some help setting it up:
  • A button opens pick-list of all the possible contents of a sector ("some debris", "an asteroid", "a star", "an artifact"; possibly "a starship" and "a planet", although I haven't encountered either of those and don't need alerts for them so we can neglect them for now).

  • The pick-list saves whichever one(s) I select to a variable list.

  • A trigger reads the MOO output and, upon finding one of the items saved to my variable list, gives me a #MESSage window.

However, how can I have the pick-list to save just the selected items to a variable list?

Also, how can I get the trigger to strip a certain items from the line "The computer reports the presence of some debris, an asteroid, and an artifact." and just check "#IF %ismember(asteroid,@contents)"? Or would the trigger phrase "^The computer reports the presence of *{@contents}*.$" work?

-McGravin
Non plaudite, modo pecuniam jacite.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Dec 19, 2002 11:35 pm   
 
Easy, use %pick() instead of #PICK. Since %pick() is a function, you can assign the return value (in the case of %pick() it will be text instead of a number) to a variable:

#variable answer %pick("p:prompt message","o:1","item1|item2|item3")

Just in case you don't already know, both %pick() and #PICK take three types of arguments:

p:text -- this is the prompt message you see in the popup window

o:# -- this controls selection options. o:1 will disable multiple selection, but I don't recall offhand if o:5 limits you to just 5 items.

other text -- this is considered the option choices presented to the user

li'l shmoe of Dragon's Gate MUD
Reply with quote
McGravin
Beginner


Joined: 30 May 2002
Posts: 25
Location: USA

PostPosted: Fri Dec 20, 2002 12:05 am   
 
Ah, the simple subtleties. Thanks much!

And I'm just using "^The computer reports the presence of *{@contents}*.$" for the trigger phrase, which seems to work fine.

-McGravin
Non plaudite, modo pecuniam jacite.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Dec 20, 2002 1:32 am   
 
The trigger to capture the messages should be:

#TR {^The computer reports the presence of (*).$} {#VAR Contents %replace(%replace("%1","and ","|"),", ","|");#FORALL @Contents {#IF (%ismember(%trim(%i),@Warnings)) {#MESSAGE {%i detected.}}}}

I might have a typo in there. Just assign the value from the %pick to Warnings and it should work.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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