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
fhqwhgads
Newbie


Joined: 15 Jun 2018
Posts: 2

PostPosted: Fri Jun 15, 2018 7:35 pm   

Looking for help with probably very basic script
 
Hello forums, I'm wondering if there is a way to combine my currently dozens of triggers into a single trigger.

It's a script to pick things up, relatively basic, there's a trigger for each item, but I'm wondering if I can do something with an array instead.

I'll shorten it to only three as an example, but the output on the mud is....

You see: a thing, something else, other object

and I have triggers looking for...

You see: a thing

You see: something else

You see: other object

...and then executing...

Code:
get a thing
look


Code:
get something else
look


Code:
get other object
look


Is there a way all of the "things" can be put into an array, and use a single trigger and action of something like...

You see: $thing

Code:
get $thing
look
Reply with quote
shalimar
GURU


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

PostPosted: Fri Jun 15, 2018 9:14 pm   
 
Yes, you can do something like that.

#VAR grabbable {a thing|something else|other object}
#TR {You see: ({@grabbable})} {get %1;look}
_________________
Windows 10 Home Premium 64-bit
AMD Phenom II x6 1055T 2.8GHz 16GB
CMUD Pro v3.34
Reply with quote
shalimar
GURU


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

PostPosted: Fri Jun 15, 2018 9:17 pm   
 
Ah, i posted to quickly

#TR {You see: (*)} {
$list=%replace(%1, ", ", "|")
#FORALL $list {#IF (%ismember(%i, @grabbable)) {get %i}}
}
_________________
Windows 10 Home Premium 64-bit
AMD Phenom II x6 1055T 2.8GHz 16GB
CMUD Pro v3.34
Reply with quote
fhqwhgads
Newbie


Joined: 15 Jun 2018
Posts: 2

PostPosted: Fri Jun 15, 2018 9:28 pm   
 
shalimar wrote:
Yes, you can do something like that.

#VAR grabbable {a thing|something else|other object}
#TR {You see: ({@grabbable})} {get %1;look}


Thanks, this got me off to a good start. Is there a way I can use wildcards with this? Sometimes things will have an adjective attached to them at random and I was using *a thing* to be able to pick up "broken a thing" or "large a thing"


edit: I understand your first example but not the second one Laughing

edit 2: I don't need the adjective in the get command "get a thing" (or even just "g a") will work for getting "huge broken dirty enchanted a thing"

edit 3: changing it to
Code:
#TR {You see: *({@grabbable})*} {get %1;look}
worked.
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