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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
surge321123
Beginner


Joined: 09 Jun 2011
Posts: 14

PostPosted: Sun Jun 19, 2011 8:21 pm   

evaluating inside a string list
 
I have a string list that requires some variability in its syntax. ie one of the items would be called

{The|} {dagger|daggers} of death.

When I try to have a trigger match it, it doesn't. That will only match if I actually see {The|} {dagger|daggers} of death, rather than The dagger of death or daggers of death. Does anyone know how to make a string list evaluate this variability? The way I am using it, I can't just make each variation its own member.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Mon Jun 20, 2011 12:42 am   
 
That code should work just fine as a trigger pattern. Perhaps you have accidentally changed one of the trigger options so that it is interpreting it literally?
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Mon Jun 20, 2011 1:54 am   
 
He wants that to be a member of an array which is the problem.

CMUD will accept an annonymous variable like that in trigger patterns, but it doesn't like named variables looking like that.

Is there a reason you need this in a named variable?
There is no limit on the size of variables (that you are likely to reach) so you CAN have them as separate entries.
_________________
Discord: Shalimarwildcat
Reply with quote
surge321123
Beginner


Joined: 09 Jun 2011
Posts: 14

PostPosted: Mon Jun 20, 2011 4:20 am   
 
There is a place I can go and find out how many of a unique piece of gear is currently out. I have a tracker for it. I go there and check all the uniques and this trigger is taking the number out and the item and checking the database....

so there are up to 4 variations on a single item, and it can show IDd, unIDd, plural, or singular. So I can have all 4 as separate members of the string list, but then when I go to print which uniques are out and their numbers, how do I know which version to check? if I look at @uniquelist.5, it will say 0, @uniquelist.6 is 0, @uniquelist.7 is 0, but 8 shows there are 4 of them currently out. I hope that helps shed light on why I'm doing it the way I'm doing it. And I realize my syntax for accessing the values in the db var isn't correct, just an easy way to explain it
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Mon Jun 20, 2011 5:55 am   
 
Hmm... i see what you are doing, but perhaps it would be better to something like:

Code:
#TR {^({%w|}) dagger({s|}) of death} {
  $num=1
  #IF (%2="s") {
    $num=2
    #SWITCH (%1)
      ("Three") {$num=3}
      ("Four") {$num=4}
    }
  #ADDKEY uniquelist {deathDagger=$num}
}


for each item you want to track
_________________
Discord: Shalimarwildcat
Reply with quote
surge321123
Beginner


Joined: 09 Jun 2011
Posts: 14

PostPosted: Tue Jun 21, 2011 2:55 am   
 
yea well thats how I originally did it... I had about 120 triggers... that's why I moved to a database.

Now I am using a database that has all the syntaxes that will come out, with values of the record number in the second database. The second database is a list of each unique and the values are the number that are out. So I am catching the name in one database, using that to find the unique in the second database, then setting the number of uniques out there. My goal is to make it a single database, but having trouble there...
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Tue Jun 21, 2011 3:16 am   
 
having alot of triggers is not neccisarily a bad thing, it can even be faster then using one huge all encompasing variable.
Especially if you put them all into a class that only gets turned on when you check for what is needed.
_________________
Discord: Shalimarwildcat
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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