Help with creating multiple variables via trigger

Posted by Karl_Newbie on Tue 08 Jun 2004 05:35 AM — 3 posts, 13,822 views.

USA #0
Hi. I've been experimenting some but reached an impasse here.
Many objects in the mud are entirely identical in name and keywords. If there are 3 packs in your character's inventory the mud always has one pack randomly set as the default target of eg 'exam pack' 'get out of pack'

The solution is to use the object's unique identification number eg pack: 324234 or pack: 2342342 or pack: 3423423. eg exam 2342342

Now it is easy enough to make an alias for each pack p1, p2, p3. But I often have scripts that utilize those specific identification numbers which leads to problems since the id numbers change often enough.


I was wondering how to do a script that when I get the identification numbers of all the objects in my inventory, if each pack could be set to a variable eg. p1, p2, p3. And the scripts could expand those variables.

The problem I have is that if I make a trigger to catch a pack: *, and set it as a variable it will always set the pack that appears in the output last as the pack variable called by the script.

Checking the inventory would call this up
The identification numbers are:
pack: 3453453
herb: 534534
cup: 3423423
duck: 343242
pack: 9234
pen: 234224
bag: 342429
pack: 34234
>

Every object in the realm has a unique idenfication number

I would want each of those packs to then set by trigger as variables pack1, pack2, pack3 which I could have expandle in by aliases and triggers eg exam p1 sends examine @pack1


The problem is I only know how to set one of the packs as a variable since the trigger is only set to match ;pack: *; and create variable 'pack1'

How could I get the trigger to take the second occurance of a pack as variable pack2, and third as pack3 and so on?

Thanks
Amended on Tue 08 Jun 2004 05:39 AM by Karl_Newbie
Australia Forum Administrator #1
What I would do is, whatever starts this process off zeroes out a "pack count".

eg.

Trigger: The identification numbers are:
Send: 0
Send to: variable
Variable: pack_count

---

Then when each "pack: *" trigger fires you would "send to script" something like this:

'
' add 1 to pack count
'
setvariable "pack_count", cint (getvariable ("pack_count")) + 1

'
' remember id for pack x
'
setvariable "pack" & getvariable ("pack_count"), "%1"
USA #2
Works perfectly. I copied the idea for making multiple variables for other objects by turning the by turning on and off sword: * bottle * triggers. Thanks