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
nostra
Wanderer


Joined: 23 May 2001
Posts: 68
Location: Sweden

PostPosted: Fri Jun 11, 2004 2:54 pm   

Advanced list-manipulation question
 
Hi everyone,

I need help with "list variable set-up". Specifically, when I receive a quest I want a script that colors the mobs I'm looking for. And after they have been killed I need to remove them from the script.

Problem: Mobs have "two names"
1)'questname' = 'name you see when fighting the mob'
2) 'roomname' (that is, the name you see when you are in the same room as the mob)

This is what (I figured) I need to do:
a) Create a static master "record variable list" with both names (giant yeti | old grumpy yeti roaming around). @allmobs (simple)

b) write a trigger that adds the mobs I have to kill for my quest to a string list @questmobs (simple)

c) I need to match values in questmobs with allmobs (keys) and merge this to a third record variable list (with matched keys and value). @questlist (not sure how to do this).

d) Finally, I need three triggers (3rd one is difficult for me):

...d1) One that colors key value (questname)
...d2) One that colors record value (roomname)
...d3) One that removes the record from the list once the mob has been killed (since I'm not doing the quest in any particular order I cannot use the #DELN 1 command)

So, in short. I don't know how to match and merge values from string list with key value in 'record variable list' to a third list (see example below):

@questmobs
giant yeti
a human

@allmobs
giant yeti | hovering yeti
a human | mad human hovering
slobbering dwarf | drooling dwarf glaring at you
a halfling | a furry creature

[merged] @questlist
giant yeti | hovering yeti
crazy human | mad human hovering

Any ideas? Cool

Kindly,
Mikael
Reply with quote
Mike Z Red
Beginner


Joined: 11 Jun 2004
Posts: 11
Location: USA

PostPosted: Fri Jun 11, 2004 4:39 pm   
 
Look at my response to your previous list-comparison post. This is essentially the same thing, except you want to compare values in two DBvars.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Jun 11, 2004 6:42 pm   
 
Trigger patterns can match list-variables or the keys of record-variables. They don't match the values of record-variables. Since you want to color the long names ('roomnames'), you need to put the long names in a list-variable, or use them as the keys of a record variable, or make individual #CW triggers for them. The first option seems simplest.

#TR {{@questmobs}} {#CW hi,blue}
#TR {{@questlist}} {#CW hi,green}
#TR {go on quest to kill (*)} {#ADDI questmobs {%1};#IF %iskey( @allmobs, "%1") {#ADDI questlist {%db( @allmobs, "%1")}} {#SAY Not in master list}}
#TR {You have killed ({@questmobs})} {#DELI questmobs {%1};#IF %iskey( @allmobs, "%1") {#DELI questlist {%db( @allmobs, "%1")}}}
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