 |
fhqwhgads Newbie
Joined: 15 Jun 2018 Posts: 2
|
Posted: 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 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
|
|
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4790 Location: Pensacola, FL, USA
|
Posted: 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} |
|
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4790 Location: Pensacola, FL, USA
|
Posted: 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}}
} |
|
|
|
 |
fhqwhgads Newbie
Joined: 15 Jun 2018 Posts: 2
|
Posted: 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
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. |
|
|
|
 |
|
|
|
|
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
|
|