ANother Q:

icon315

Member
Is there a way to make mafia get items in order to adventure....kind of like a "Item Mood"
For example it has to have 3 flasks of oil of oiliness, sewer wad, etc... in order to adventure...and if it doesn't that it gets them...this also includes the gatorskin umbrella. mafia tells you when you run out, but it doesn't stop and it doesn't get one
 

lostcalpolydude

Developer
Staff member
With Preferences -> General -> "Require appropriate test items to adventure in clan sewers" checked, it should be impossible to adventure in the sewers without them. Or maybe it just stops you. Is it not stopping you?

In any case, you could write a betweenBattleScript that checks if you have the items, and then gets them if you don't. You would use set betweenBattleScript=scriptname.ash to start using it, and set betweenBattleScript= to stop using it.
 

Bale

Minion
Sure, you can make an item mood. After you make the script to get those items when you run low (as lostcalpolydude says), put that script in your mood as an unconditional trigger.
 

slyz

Developer
It's pretty simple. Build a map of items, check how many you have against how many you need, acquire if needed:

Code:
int[item] ItemsToHave;
ItemsToHave[$item[oil of oiliness]] = 3;
ItemsToHave[$item[sewer wad]] = 1;

foreach itm in ItemsToHave {
     if ( item_amount(itm) < ItemsToHave[itm] ) {
          if( !retrieve_item( (ItemsToHave[itm]-item_amount(itm)), itm ) )
               abort("Couldn't acquire enough "+itm);
     }
}

Regarding sewer items, check my very first contribution here.
 

Bale

Minion
Might as well finish that.
Code:
int [item] Sewer_Items;
Sewer_Items[$item[sewer wad]] = 1;
Sewer_Items[$item[unfortunate dumplings]] = 1;
Sewer_Items[$item[bottle of Ooze-O]] = 1;
Sewer_Items[$item[oil of oiliness]] = 3;
Sewer_Items[$item[gatorskin umbrella]] = 1;

foreach itm, qty in Sewer_Items
   if ( item_amount(itm) < qty && !retrieve_item( qty, itm ) )
         abort( "Couldn't acquire enough "+itm );
if( !have_equipped($item[gatorskin umbrella] ))
   equip( $item[gatorskin umbrella] );
 
Last edited:

icon315

Member
Ok i did this and i keep getting a popup box that says Please input a value for string command What do i put here?


EDIT: Ok FORGET what i said...wrong place

EDIT#2: I keep getting the error

Code:
Expected ), found equip (SewerAdventure.ash, line 12)
 
Last edited:

Bale

Minion
Code:
Expected ), found equip (SewerAdventure.ash, line 12)
That means exactly what it says. It is expecting to see a close parenthesis, instead if found the command equip on line 12. I forgot a ) at the end of line 11. Oops. Add it.
 

icon315

Member
TY very much

ugh....New error

Code:
Script parsing error (SewerAdventure.ash, line 13)

Btw is there a place i can see what each error means?
 
Last edited:

Bale

Minion
In this case, the parsing error refers to the dangling } at the end. That was just kinda left over from slyz's script and I forgot to remove it. I thought that since you said "Time to research on how to make that script" you had some idea how to debug stuff.

There is no list of parsing errors and what they mean. Most of them are pretty self-explanatory line the first, although the second is pretty clueless.
 

icon315

Member
ok onelastthing....how do you make it so that it doesn't unequip then requip the umbrella after ever battle

EDIT: Never mind figured it out...you just have to remove
Sewer_Items[$item[gatorskin umbrella]] = 1;
 
Last edited:

icon315

Member
OK that sucks.....it didn't work now it won't try to acquire the umbrella if i don't have it....how do i fix this?
 

Bale

Minion
The lines you're looking for are
Code:
if( !have_equipped($item[gatorskin umbrella] ))
   equip( $item[gatorskin umbrella] );
If you remove those it will stop equipping an umbrella. Are you saying that even if you have the umbrella equipped, it will still unequip it and equip it again? It should only re-equip the umbrella if it is destroyed by a sewer test.
 

icon315

Member
Are you saying that even if you have the umbrella equipped, it will still unequip it and equip it again? It should only re-equip the umbrella if it is destroyed by a sewer test.


Yes that is exactly what i am saying
 

Bale

Minion
I've got a hunch about what the problem might be. Try this then,

Code:
int [item] Sewer_Items;
Sewer_Items[$item[sewer wad]] = 1;
Sewer_Items[$item[unfortunate dumplings]] = 1;
Sewer_Items[$item[bottle of Ooze-O]] = 1;
Sewer_Items[$item[oil of oiliness]] = 3;
Sewer_Items[$item[gatorskin umbrella]] = 1;

foreach itm, qty in Sewer_Items
   if ( item_amount(itm) < qty )
      if( !retrieve_item( qty, itm ) )
         abort( "Couldn't acquire enough "+ to_plural(itm) +"." );
if( !have_equipped($item[gatorskin umbrella] ))
   equip( $item[gatorskin umbrella] );
 

Bale

Minion
Please let me see your CLI output or session log for the problem and the adventure before the problem. It might give me a clue as to what is going on.
 

Bale

Minion
OH hell. Of course. Stupid of me, really.

I forgot that a mood cannot change gear. It will always revert to the previous weapon when the mood check is over. Regardless. It's annoying, but essential to keep mood maintenance from screwing up other things.

However, between battle scripts are allowed to change equipment. I'd suggest removing this from your mood instead you should set it as a betweenBattleScript

Code:
set betweenBattleScript = SewerAdventure.ash
 
Top