|
ballegator Novice
Joined: 19 Jun 2001 Posts: 30 Location: USA
|
Posted: Tue Jan 29, 2002 7:52 pm
Alias for Auto-putting Spell Comps into a Bag |
I am on a mud where you have to buy spell components. They are listed in your inventory as
Mud (spell component)
Dirt (spell component)
Sand (spell component)
You have to put these components in a components bag which I keep in my robe. What I want is if I have multiple components in my inventory, to be able to capture them with one command and put them all in my bag and put the bag back in my robe. The command for bag retrieval and putting it back in are
Get bag from robe
Put bag in robe
And the command for putting the components into the bag are
put dirt into components bag
I tried an alias like
Comp * (and i tried Comp %w)
get bag from robe
put * into components bag
put bag in robe
Obviously I am clueless. Any help? |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Wed Jan 30, 2002 2:06 am |
quote:
I am on a mud where you have to buy spell components. They are listed in your inventory as
Mud (spell component)
Dirt (spell component)
Sand (spell component)
You have to put these components in a components bag which I keep in my robe. What I want is if I have multiple components in my inventory, to be able to capture them with one command and put them all in my bag and put the bag back in my robe. The command for bag retrieval and putting it back in are
Get bag from robe
Put bag in robe
And the command for putting the components into the bag are
put dirt into components bag
I tried an alias like
Comp * (and i tried Comp %w)
get bag from robe
put * into components bag
put bag in robe
Obviously I am clueless. Any help?
#VARIABLE Components {List=""|inventory=""
}
#TRIGGER {({@Components.List}) ~(spell component~)} {@Components.inventory = %additem(@Components.inventory,%1)}
#ALIAS StoreComponents {
get bag from robe
#FORALL @Components.inventory {put %i in bag}
put bag in robe
@Components.inventory = ""
}
EDIT: if there is an ending line for your inventory or something, I'd recommend using that to fire off the alias
li'l shmoe of Dragon's Gate MUD |
|
|
|
ballegator Novice
Joined: 19 Jun 2001 Posts: 30 Location: USA
|
Posted: Wed Jan 30, 2002 5:31 am |
This is how I modified what you gave me:
#VARIABLE Components {List=""|inventory=""}
#TRIGGER {({@Components.List}) ~(a spell component~)}{@Components.inventory = %additem(@Components.inventory,%1)}
#ALIAS StoreComponents {get bag from robe
#FORALL @Components.inventory {put %i in bag}
put bag in robe
@Components.inventory = ""}
When I type in StoreComponents I get the following is echoed to the mud:
get bag from robe
put in bag
put bag in robe
And this is what the mud returns:
You get A leather bag from bright green robe (worn).
You are not carrying .
You put A leather bag in bright green robe (worn).
It is missing capturing the components in my inventory. Just so you can see, here is what shows when I look at my inventory:
You are carrying:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Cowl of Knowledge (worn)
Zinc (a spell component)
nine large cloth sacks
A small statue of a half-elf
Hide armor (worn)
gold ring (worn)
Many skinned cloak (worn)
(A tattoo (worn))
A kit of blue healing vials [28 left]
A large sheath (worn)
bright green robe (worn)
bracers (worn)
A small belt pouch (worn)
and Water (a spell component)
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Not sure what's wrong but I would guess someone could figure it out. |
|
|
|
iljhar GURU
Joined: 10 Oct 2000 Posts: 1116 Location: USA
|
Posted: Wed Jan 30, 2002 5:43 am |
Well, it looks like you never populated @Component.list anywhere in your post. Did you happen to do that first? It looks like if you don't have @Component.list filled out, the trigger will never add the component to @Component.inventory...
Iljhar |
|
|
|
ballegator Novice
Joined: 19 Jun 2001 Posts: 30 Location: USA
|
Posted: Wed Jan 30, 2002 5:46 am |
What do you mean? Do I need to type Inventory first?
|
|
|
|
iljhar GURU
Joined: 10 Oct 2000 Posts: 1116 Location: USA
|
Posted: Wed Jan 30, 2002 6:14 am |
Well, your trigger says this:
#TRIGGER {({@Components.List}) ~(a spell component~)} {@Components.inventory = %additem(@Components.inventory,%1)}
So, your trigger would have to have something in @Components.List first so it knows to add it to your inventory... as of right now, it looks like your @Components.List is null, so, your trigger translated would look like this:
#TRIGGER {({}) ~(a spell component~)} {@Components.inventory = %additem(@Components.inventory,%1)}
And your trigger can't add anything to the @Components.inventory since there's nothing to add. So I'm thinking you need to populate the @Components.List first before you run this trigger. I don't play around much with data record variables, so I may be way off base here, heh. This is the way I'd do it, it's probably not as efficient, but it gets the job done:
#VARIABLE List {Mud|Dirt|Sand}
#TRIGGER {({@List}) ~(a spell component~)} {#VARIABLE Inventory %additem(%1, @Inventory)}
#ALIAS StoreComponents {get bag from robe;#FORALL @Inventory {put %i in bag};put bag in robe;@Inventory = ""}
If you don't want a list, you can just do something like this:
#TRIGGER {(%w) ~(a spell component~)} {#VARIABLE Inventory %additem(%1, @Inventory)}
Hope I've helped and not added to the confusion, heh.
Iljhar |
|
|
|
ballegator Novice
Joined: 19 Jun 2001 Posts: 30 Location: USA
|
Posted: Wed Jan 30, 2002 4:30 pm |
Thanks, Iljhar. I used what you wrote without the variable list (because there are so many spell components in this mud). Now all I have to do is type 'i' for inventory the 'sc' which is the alias I gave it.
Thanks so much! |
|
|
|
|
|