|
Habbs Newbie
Joined: 10 Mar 2008 Posts: 5
|
Posted: Mon Mar 10, 2008 8:47 pm
Get item from container, give that item to someone. |
I am trying to figure out a script to get items out of a specific container, flag what that item was, and then issue follow up commands with that item included.
I'm going to have one variable that will be mostly static called @hcontainer, and a macro button to call the alias when needed.
Then, I was trying something like this:
#CLASS FamEat
#VAR eatitem {}
#ALIAS fameat {{get 1. @hcontainer; #TRIGGER {You get ~ %i ~ from @hcontainer};eatitem=%i;give @eatitem pet; pet eat 1.}}
#CLASS 0
The point of this is that the items in the container can be named anything, but I want to make sure that I only give what I get out of the container to them, as they will eat anything and could destroy useful items if I give the wrong thing. I'm not sure if I am even close on the way to do it, but that is what I was thinking of so far. One specific part I am unsure of is storing the item name when I get it out of the container, as the name could be something like a pieace of eating goodness, or some stuff to eat...so I was thinking to use the second word but wasn't sure if that would be %-1 or %i or what. |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Mon Mar 10, 2008 9:25 pm |
Does your MUD complain if you issue two commands one right after the other?
If not then you could do something like this.
#alias fameat {get %-1 @hcontainer;give %-1 to pet;pet eat %-1}
To use this you could type.
fameat cake
or
fameat a piece of eating goodness
or
fameat oat bran
If your MUD Does complain about your entering commands rapidly then you could do this.
#TRIGGER "petFeed" {You get * from @hcontainer} {give @eatitem pet;pet eat @eatitem;#T- petFeed}
#alias fameat {eatitem={%-1};#T+ petFeed;get @eatitem from @hcontainer}
And use it the same way I showed above.
Note that the trigger may need a little tinkering as I am not certain that @hcontainer will always contain the correct item. The easiest thing would be to simply omit it from the end of the trigger altogether. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
Habbs Newbie
Joined: 10 Mar 2008 Posts: 5
|
Posted: Mon Mar 10, 2008 9:33 pm |
No problem using multiple command all together, so the one line thing should work, I was as usual making it harder than I needed to. I'll test it when I get home form work, but out of curiosity, will the get %-1 @container just take the first thing out and save that name? I was thinking I had to tell it to get 1. to get the first item, and then pick up what that item was. Since this looks like it isn't the case that makes things a lot better.
Thanks! |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Mon Mar 10, 2008 9:37 pm |
The %-1 holds everything you typed after fameat. So if you typed chocolate cake then you will try to get chocolate cake.
If you don't like that it is doing this then you would need to use %1 instead of %-1. But it sounded to me like you were wanting everything. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
Habbs Newbie
Joined: 10 Mar 2008 Posts: 5
|
Posted: Mon Mar 10, 2008 10:50 pm |
Ahh, yes, the whole line is is fine, but the problem is that I don't know what the item will be. The idea is everything int he container will be ok to grab for this, but I only want to give that item I give to them to eat. So I wanted it to be the first thing in the container, and then store that name so that for example if I have 3 things left, and hit the command 4 times, the last time it will get nothing from the bag, and give nothing either instead of the first thing in my inventory.
I was just useing get 1. @container;give 1. pet;peat eat 1.....but ran into problems when the container was empty and I gave them somethign to eat that I needed. |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Mon Mar 10, 2008 11:04 pm |
In that case you need something like this instead...
Note that I don't know what the you fail to get item because container is missing message actually looks like on your mud.
#TRIGGER "petFeed" {You get * from @hcontainer} {give 1. pet;pet eat 1.;;#T- petFeedE;#T- petFeed}
#TRIGGER "petFeedE" {The * is empty} {#T- petFeed;#T- petFeedE}
#alias fameat {#T+ petFeed;#T+ petFeedE;get 1. from @hcontainer} |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
|
|