Looking for help making a script for wadbotting castle items.

monster hunter

New member
Beginrar.

I've found plenty of scripts where you can send items to wadbot, but you have to know how many items you have and you won't get the same amount of items after each session of farming.

How would I configure a script to check how many of each waddable items I have? Or just send them all?
 

me259259

Member
If you want to send them all with ash, all you need to use is available_amount. However, if you are sending items through a kmail, you are probably using the command line, or ash's version of the command line. To select all items from the command line, use a "*".

The following send all of your stuffed cocoabos to holatuwol :

PHP:
cli_execute("send * stuffed cocoabo to holatuwol") ;

If you want to autosell all of your Procrastination Potions, you would probably want to do it this way:

PHP:
autosell(available_amount($item[procrastination potion]), $item[procrastination potion]) ;

When I had first started to learn how to code, the line above confused me. Just remember that
PHP:
available_amount($item[procrastination potion])
returns a number, and mafia (and any other program) will only view it as a fancy way of saying a number.
 
Last edited:

Theraze

Active member
Probably want item_amount for items actually in inventory (while farming) rather than available_amount, which would sell equipped items and anything else that might not be directly a part of farming. Not that much from the castle is great for wearing, but... :)
 

roippi

Developer
Should probably check out OCD inventory control for code inspiration. Or just for using it.
 

Bale

Minion
Or else just use * for all since send is a cli command. It works fine and there's no reason to get complicated. me259259's answer was pretty good advice.
 

monster hunter

New member
If you want to send them all with ash, all you need to use is available_amount. However, if you are sending items through a kmail, you are probably using the command line, or ash's version of the command line. To select all items from the command line, use a "*".

The following send all of your stuffed cocoabos to holatuwol :

PHP:
cli_execute("send * stuffed cocoabo to holatuwol") ;

If you want to autosell all of your Procrastination Potions, you would probably want to do it this way:

PHP:
autosell(available_amount($item[procrastination potion]), $item[procrastination potion]) ;

When I had first started to learn how to code, the line above confused me. Just remember that
PHP:
available_amount($item[procrastination potion])
returns a number, and mafia (and any other program) will only view it as a fancy way of saying a number.

Would this work? I heard there's a difference between csend and other commands. Something to do with the Hush hush message from Mafia?
How would you send multiple items at once? Same for the autosell :) I know you can run the cli command multiple times, but I'd rather keep it condensed.

Code:
cli_execute("csend * wolf mask to wadbot");
 

Bale

Minion
How would you send multiple items at once? Same for the autosell :) I know you can run the cli command multiple times, but I'd rather keep it condensed.

Commas are your friends.

Code:
cli_execute("csend * wolf mask, * giant needle to wadbot");

For autoselling in ash, use multiple autosell commands, but precede the first with batch_open() and follow the last with batch_close(). It will then automatically combine them into groups of 11 for execution.
 
Last edited:

monster hunter

New member
Awesome!

So so far I've got:

Code:
  #### Send waddable Giant's Castle items to Wadbot
  ## "*" means all of that item, and can be replaced with a value.
  cli_execute("csend * wolf mask, * giant needle to wadbot");
  
  
  #### Autosell remaining Giant's Castle Items
batch open ()
  autosell(available_amount($item[heavy D]), $item[heavy D]) ; 
  autosell(available_amount($item[original G]), $item[original G]) ; 
  autosell(available_amount($item[disturbing fanfic]), $item[disturbing fanfic]) ; 
  autosell(available_amount($item[furry fur]), $item[furry fur]) ; 
  autosell(available_amount($item[awful poetry journal]), $item[awful poetry journal]) ;
  autosell(available_amount($item[thin black candle]), $item[thin black candle]) ; 
  autosell(available_amount($item[chaos butterfly]), $item[chaos butterfly]) ;
  autosell(available_amount($item[plot hole]), $item[plot hole]) ; 
  autosell(available_amount($item[probability potion]), $item[probability potion]) ; 
  autosell(available_amount($item[procrastination potion]), $item[procrastination potion]) ; 
  autosell(available_amount($item[angry farmer candy]), $item[angry farmer candy]) ;
  autosell(available_amount($item[Mick's IcyVapoHotness Rub]), $item[Mick's IceVapoHotness Rub]) ;
  autosell(available_amount($item[rave whistle]), $item[rave whistle]) ;
batch close ()

Correct? Can't currently test because I already junk-sold everything. Could you elaborate more on the batch () commands? What determines whether or not you should use the cli_execute command?

How would I go about mallselling all my returned wads?
How would I go about using all my gift certificates?
Assuming something like:
Code:
cli_execute("use * Warm Subject gift certificate");
cli_execute("mallsell * Twinkly Wad @ 350 limit 15");

How would I mallsell all but 15 twinkly wads? Yea I wanna know how to do either/or

I'm guessing the whole script will stop if I happen to be missing an item. How do I stop that from happening?

Read through basic scripting, but still have so many questions. Btw, thanks a ton to anyone that helps! I'll post the entire script just in case anyone ends up wanting it (along with the logout script that this is part of).
 

monster hunter

New member
If you want to send them all with ash, all you need to use is available_amount. However, if you are sending items through a kmail, you are probably using the command line, or ash's version of the command line. To select all items from the command line, use a "*".

The following send all of your stuffed cocoabos to holatuwol :

PHP:
cli_execute("send * stuffed cocoabo to holatuwol") ;

If you want to autosell all of your Procrastination Potions, you would probably want to do it this way:

PHP:
autosell(available_amount($item[procrastination potion]), $item[procrastination potion]) ;

When I had first started to learn how to code, the line above confused me. Just remember that
PHP:
available_amount($item[procrastination potion])
returns a number, and mafia (and any other program) will only view it as a fancy way of saying a number.


Problem with autoselling..... that sends the items to the mall
 

Bale

Minion
First of all, you forgot to put a semi-colon after batch_open() and batch_close(). Also, you used a space instead of an underline in the function name. Function names cannot contain spaces, ever.

Second of all, here's something neat:

Code:
#### Send waddable Giant's Castle items to Wadbot
## "*" means all of that item, and can be replaced with a value.
cli_execute("csend * wolf mask, * giant needle to wadbot");
  
  
  #### Autosell remaining Giant's Castle Items
batch_open();
foreach it in $items[heavy D, original G, disturbing fanfic, furry fur, awful poetry journal, thin black candle, chaos butterfly, plot hole, probability potion, procrastination potion, angry farmer candy, Mick's IcyVapoHotness Rub, rave whistle]
   autosell(item_amount(it), it) ;
batch_close();
## foreach will execute the autosell line multiple times with [B]it[/B] 
## being each of the following items in order.
##

See the way I combined all those autosell commands? If you don't get it, then you don't have to do it that way, but if you can understand how to make use of that it will save you a lot of typing.

What determines whether or not you should use the cli_execute command?
I recommend only using a cli_execute command when there is a cli command that does not have an ash equivalent. Since ash gives you more specific control, it is generally better to use ash in an ash script.

Code:
How would I go about using all my gift certificates?

I'd do it like this: use(item_amount($item[Warm Subject gift certificate], $item[Warm Subject gift certificate]);

How would I mallsell all but 15 twinkly wads? Yea I wanna know how to do either/or

I'd do that like this:

Code:
int amnt = item_amount($item[twinkly wad]) - 15;
if(amnt > 0)
   put_shop(350, 15, amnt, $item[twinkly wad]);

The first parameter of put_shop() is price. Second parameter is the limit. Third parameter is the amount and the fourth is the item. Full documentation for this is HERE. The above code can also be written as the following:

Code:
if(item_amount($item[twinkly wad]) - 15 > 0)
   put_shop(350, 15, item_amount($item[twinkly wad]) - 15, $item[twinkly wad]);


How would I go about mallselling all my returned wads?

That's trickier since mafia does not know about items which are mailed to you. I'd recommend dealing with the previous day's wads that were sent by wadbot, leaving today's wads until tomorrow. It's much simpler then checking for an incoming message from wadbot and refreshing inventory if you get one.
 
Last edited:

Theraze

Active member
Tiny fix... the twinkly wad bit above is just for selling all or 0, whichever is higher. It doesn't keep 15. To do that, you'd need to do something like:
max(item_amount($item[twinkly wad]) - 15, 0)
for your twinkly count.
 

Bale

Minion
Oh... oops. Thanks Theraze. I obviously forgot that tiny little detail after making sure that the subtraction didn't accidentally go below zero. :eek: I edited the correction into my post for clarity.

Unfortunately you missed another serious bug with that post. If I try to sell 0 of an item, then it will sell ALL. I edited that fix in also. It should be this:

Code:
if(item_amount($item[twinkly wad]) - 15 > 0)
   put_shop(350, item_amount($item[twinkly wad]) - 15, amnt, $item[twinkly wad]);
 
Last edited:

Theraze

Active member
Hmm... yeah, I considered that possibility, but since it wasn't my script to run, I figured that any major reworkings and the "if (item_amount() > 15)" part was probably just something for fun.

For that matter, am I misremembering... can you sell -15 to dispose of all but 15 of an item? Or am I mixing commands up?
 

Bale

Minion
Not my script either. We are trying to give useful advice here.

For that matter, am I misremembering... can you sell -15 to dispose of all but 15 of an item? Or am I mixing commands up?

Almost. That works with CLI. It does not work with ASH.
 

Theraze

Active member
Ah... the joys of ASH/CLI slight variances. Not so useful when we're dealing with batched commands to save time. Fine if we're just calling a single command.

And yeah... I'd eventually have come back to the required if, but first thing in the morning pre-caffeine I wasn't feeling confident in my memories. Don't tell people they're missing things when it's really your own comprehension that's missing, etc. :)
 

monster hunter

New member
Thanks guys! For now I'll stick with the CLI commands, and implement what you guys wrote after I learn ASH a little more.

Fixed: mafia's hush hush message messing up wadbot requests.
Fixed: autosell mallselling items

Here's the code

Code:
  #### Send waddable Giant's Castle items to Wadbot
  ## "*" means all of that item, and can be replaced with a value.
  cli_execute("send * wolf mask, * giant needle to wadbot || wad");
  
  
  #### Wait for wads to appear.
  if(item_amount($item[Twinkly Wad]) < 1)
  	repeat {wait(5); refresh_status();}
	until (item_amount($item[Twinkly Wad]) > 1);
  
  
  #### Mallsell recieved Twinkly Wads
  ## Modify: mallsell [#] <itemname> @ <price> limit <limit>
  cli_execute("mallsell -15 Twinkly Wad @ 350 limit 15");
  
  
  #### Use Warm Subject Gift Certificates
  ## You'll get more money this way than if you autosell
  cli_execute("use * Warm Subject gift certificate");
  
  
  #### Autosell remaining Giant's Castle Items
  cli_execute("autosell * heavy D, * original G, * disturbing fanfic, * furry fur, * awful poetry journal, * thin black candle, * chaos butterfly, * plot hole, * probability potion, * procrastination potion, * angry farmer candy, * Mick's IcyVapoHotness Rub, * rave whistle");
 

monster hunter

New member
Man. I've really extended this topic pretty far. I really appreciate your guys' help!

I think I've got one last question, though. I'm working on a bit of code that changes my outfit for rollover.

Code:
#### Check/buy/equip +adventure equipment
  ## This will not buy the equipment if you already have it
  ## If wanting +PvP equipment, edit item names
  ## If you already have an outfit, see next section
  #General Sage's Lonely Diamonds Club Jacket and Torso Awaregness
  if (item_amount($item[sword behind inappropriate prepositions]) == 0)
    buy( 1 ,$item[sword behind inappropriate prepositions]);
  if (item_amount($item[paperclip pants]) == 0)
	buy( 25 , $item[paperclip]);
	use( 25 , $item[paperclip]);
  if (item_amount($item[BGE pocket calendar]) == 0)
	buy( 1 , $item[BGE pocket calendar]);
  if (item_amount($item[dead guy's watch]) == 0)
	buy( 1 , $item[dead guy's watch]);
  if (item_amount($item[tiny plastic bitchin' meatcar]) == 0)
	buy( 1 , $item[tiny plastic bitchin' meatcar]);
  cli_execute("equip sword behind inappropriate prepositions");
  cli_execute("equip paperclip pants");
  cli_execute("equip acc1 BGE pocket calendar");
  cli_execute("equip acc2 dead guy's watch");
  cli_execute("equip acc3 tiny plastic bitchin' meatcar");

I've used the verify command to check it, and seems it'll work. I want to add the ability to buy/equip the Club Jacket ONLY IF the character has Torso Awaregness. How would i go about doing so?
 

roippi

Developer
You should really just do cli_execute("maximize adv") instead of all of those hard-coded equip lines. The maximizer is your friend.
 

Bale

Minion
Code:
  #### Wait for wads to appear.
  if(item_amount($item[Twinkly Wad]) < 1)
  	repeat {wait(5); refresh_status();}
	until (item_amount($item[Twinkly Wad]) > 1);

This will not work. Refreshing status will not tell mafia that the twinkly wads have arrived in the mail. Doing this properly is actually extremely hard and well past beginner level. Just allow the wads to be sold a day late.


Code:
  #### Autosell remaining Giant's Castle Items
  cli_execute("autosell * heavy D, * original G, * disturbing fanfic, * furry fur, * awful poetry journal, * thin black candle, * chaos butterfly, * plot hole, * probability potion, * procrastination potion, * angry farmer candy, * Mick's IcyVapoHotness Rub, * rave whistle");

I think that won't work either, though I could be wrong. I believe that you can only put 11 different items on a single autosell line. Does anyone know if mafia will automatically split that?
 

monster hunter

New member
I have none of those items, so I think mafia sells them all just fine :)

I actually ran into problems with the refreshing status thing. I'll just have mallselling be the last thing to happen in the script, then.

You should really just do cli_execute("maximize adv") instead of all of those hard-coded equip lines. The maximizer is your friend.


Yea, haha. The very next section in the script is:


Code:
  #### Need to change outfits to equip +adventures/PvP items.
  ## NOTE: You could instead do a cli_execute("maximize adv"); if you don't have a specific outfit saved but have the equipment
  ## Uncomment "#" the line below this one if you have a +adventure/PvP outfit, and comment each of the if-then statements in the previous section
  #outfit("RolloverAdv");

Think I'll just cut all that stuff out and do what you said.
 
Last edited:
Top