PDA

View Full Version : Shopping Script



Luxelle
10-14-2015, 06:30 PM
Now that I'm moderately dangerous after Tgo01's hunting script lesson from earlier ...

I'd really like to automate the shopping experience so that it does not require so much typing. EG is coming. Even the small fest in Ta'Vaalor had my wrists hurting from all the


LOOK ON something - GET item ON something
LOOK item on something - INSPECT item on something

just to find out what it costs, looks like, and is.

But this is way beyond me.

Is there a script for it? Is it an easy script?

~L (whose wrists are just wrecked already)

Tgo01
10-14-2015, 06:44 PM
GameObj.loot.each{ |i|
if i.name !~ /disk|coffin/
fput "look on ##{i.id}"
i.contents.each{ |item|
fput "get ##{item.id}"
sleep 0.3
fput "look ##{item.id}"
sleep 0.3
fput "inspect ##{item.id}"
sleep 0.3
}
end
}


This would look on every object in the current room (that doesn't have the word disk or coffin in the name, to avoid messing with people's disks) and attempt to get, look, and inspect each item on said object.

The sleep command basically tells the script to pause for that many seconds, I put a sleep command of 0.3 seconds between each command but you can make these as low as 0.1 or as high as you want, or get rid of them altogether. You should have at least 1 sleep 0.1 command somewhere in there though otherwise the script will perform actions as fast as possible and probably crash your client or even your computer.

Luxelle
10-14-2015, 07:26 PM
And when I need to look IN something? (because it happens...)

Tgo01
10-14-2015, 07:33 PM
And when I need to look IN something? (because it happens...)

You can add it to the script.



GameObj.loot.each{ |i|
if i.name !~ /disk|coffin/
fput "look on ##{i.id}"
fput "look in ##{i.id}"
i.contents.each{ |item|
fput "get ##{item.id}"
sleep 0.3
fput "look ##{item.id}"
sleep 0.3
fput "inspect ##{item.id}"
sleep 0.3
}
end
}


I'm pretty sure the way lich is set up with the contents feature that it will still go through all contents of the object, whether they are in or on said object. Just make sure the script looks both in and on it first so the contents will be populated.

Luxelle
10-14-2015, 07:43 PM
Thank you so much! It works perfect in the pawnshop. I'll go give this a try in a player shop!

Really, my wrists thank you. And I'll bet people helping archive and collect info for the festival will love it, too!

~L

Tgo01
10-14-2015, 07:49 PM
I just remembered that some displays aren't actual "loot" items but rather they are part of the room description and thus this won't work for said display items.

There is a very simple way to get this to work for such room description items as well but I'm on my phone at the moment and don't remember the exact syntax.

If someone doesn't already provide the code before I get home then I'll post it then.

Luxelle
10-14-2015, 07:52 PM
Coding from your phone. Wow, now I feel really pampered. Thanks.

Look back when you get home :)

It works terrif in the pawnshop, but fails in a player shop. That must be why?

Tgo01
10-14-2015, 07:57 PM
Coding from your phone. Wow, now I feel really pampered. Thanks.

Look back when you get home :)

It works terrif in the pawnshop, but fails in a player shop. That must be why?

Probably. Are the display items after the "you also see" bit or are they part of the room description?

Luxelle
10-14-2015, 08:11 PM
They're in the room description in a player shop, so ... feeling moderately dangerous, I added the same function you wrote to run through the GameObj.room_desc array.

So no matter which kind of shop you are in, it will see it!

I feel like you have granted me a new SUPER POWER!

And yeah ... to use this in public, those sleep commands better be tweaked back or people with me are going to be irked.

I'm going to play some more now. Since you are on the phone and busy somewhere and all...

~L.

DaCapn
10-14-2015, 08:50 PM
I had a script on the repo called "shopsearch" at one point for searching playershops for items. It was when I was selling gem jars so you could do something like ;shopsearch uncut diamond and it would try to find the item and would ask for a confirmation before attempting to buy it. It was pretty crude and was just for player-run shops but maybe you can get some ideas of what (not?) to do. It had some hard-coded container names because of all of the shop decorations.

Also, for the sake of EG, some of the merchant inventory containers are little container clusters so you'll have something like "bins" in the room description and if you do "look bin" you'll see "a green bin, a blue bin, and a red bin" or something of that nature. It's kind of annoying so you'd have to deal with that. I'm not sure whether the containers method for GameObj can be of use here. I think the dyer's tent in Icemule has some of these container clusters if you'd like to test it out. Perhaps the other dyer's tents have this sort of thing as well.

The rabbit hole scales with how bulletproof and seamless you want the script to operate. Good luck, would be handy.

Luxelle
10-14-2015, 09:13 PM
Oooh, that's right, DaCapn, thank you for that reminder. I saw some like that at the Ta'Vaalor fest, too.

The dyes here in Ta'Illistim are just on individual things, not "nested". I will have to trek to Icemule later and see what happens!

~L