A little help making a logout script.

Miatog

New member
I'm trying to make a script for mafia to help automate my logging out and keep me from being a stupid moron that didn't put his time outfit on. Then it hit me, if I get a 3rd sword and check if I have double fisted and grimace's phase, I could farther maximize my turns.

While I'm new to .ash scripting, I think I can do most of this just fine. Where I have trouble...is checking grimace...please tell me there's some function I'm not finding on the wiki for this.

What I need is how to check what darkness grimace is in (how ever it comes, 0-5 would be nice for my brain but if I can't get it that way I'll deal). Thanks in advance.
 

Spiny

Member
just use the modifier maximizer to maximize for adventures. Or simply "maximize adv" in the cli.
 

Bale

Minion
You'll have to equip the disembodied hand yourself though if you want it to hold one of your time swords. Does anyone know if the maximizer will know to give a time sword to the hand?
 

zarqon

Well-known member
I call "maximize adv" followed by this, which handles equipping a time sword on your disembodied hand:

Code:
// maximizes rollover aventures from your Disembodied Hand
boolean time_on_hand() {
   if (!have_familiar($familiar[disembodied hand])) return true;
   if (familiar_equipped_equipment($familiar[disembodied hand]) == $item[time sword]) {
      use_familiar($familiar[disembodied hand]);
      if (familiar_equipped_equipment($familiar[disembodied hand]) == $item[time sword])
         return true;
   }
   if (item_amount($item[time sword]) == 0 && item_amount($item[sword behind inappropriate prepositions]) > 0 && equipped_amount($item[time sword]) == 1)
      equip($item[sword behind inappropriate prepositions]);
   if (item_amount($item[time sword]) > 0) {
      use_familiar($familiar[disembodied hand]);
      return equip($slot[familiar],$item[time sword]);
   } else return true;
}
 

jasonharper

Developer
I don't actually have a Hand to test this, but the Maximizer should be capable of equipping a time sword on one, when appropriate.
 

zarqon

Well-known member
@Jason: But, you still have to use the Hand as your familiar first, correct? If so, I think I'll hang on to my code, since I don't want to switch to the Hand for characters that either lack time gear or should be dual-wielding time.

Just thought of this: should I also consider the hatrack with the time helmet? I'll have to look into that.
 

Bale

Minion
Just thought of this: should I also consider the hatrack with the time helmet? I'll have to look into that.

Hats do not give you their special power on a hatrack. It does not work like a disembodied hand. It turns the hatrack into a familiar that does something in a combat.

In the case of a time helmet, the hatrack will act like a temporal riftlet, sometimes giving an extra adventure at the end of the fight. It does not give rollover adventures.
 

jasonharper

Developer
Right, you do have to select the familiar first. Hopefully someday there will be a Maximizer keyword for specifying a familiar to consider switching to...
 

zarqon

Well-known member
Familiars ARE basically just equipment, so it would be nice if the maximizer also considered them. Likewise with outfit checkpoints.

And thanks, Bale.

Bale is better than the wiki because a) he has opinions to go with the facts, and b) you don't even have to search!
 

Rinn

Developer
I can confirm that the maximizer is smart enough to equip the disembodied hand if it's your active familiar.
 

Bale

Minion
Sweet. So all that is needed then is...

Code:
if(have_familiar($familiar[disembodied hand]) && item_amount($item[time sword]) > 0)
   use_familiar($familiar[disembodied hand]);
cli_execute("maximize adv");

Nice try zarqon, but I think my code is far better than your code. I can't believe it took you 13 lines to do what I did in 3.
 

zarqon

Well-known member
Ah, but they're not the same. Yours will fail if the Hand already has your time sword (or you do) -- should have used available_amount(), although that could still semi-fail if your "available" sword is in storage. Additionally, mine saves a server hit switching familiars if you end up not equipping a time sword on the Hand.

But it is true that now that the maximizer apparently also handles familiar gear, all that code to save two server hits is a little silly.

PHP:
void hand_check() {
   if (!have_familiar($familiar[disembodied hand]) || available_amount($item[time sword]) == 0 ||
       (available_amount($item[time sword]) == 2 && available_amount($item[grimacite gravy boat]) == 0 && have_skill($skill[double-fisted]))) return;
   use_familiar($familiar[disembodied hand]);
}

This could still waste a server hit using the Hand if you don't have any other adventures-granting swords -- or if you have a gravy boat. But I do like letting mafia handle the maximizing decisions, so it's a compromise I'm willing to live with.
 

Bale

Minion
Well... yours will fail to grant max adventures if the grimacite gravy boat gives 0 adventures, you have a preposition sword and you're missing the time helmet or trousers. :)

It may be an unnecessary server hit, but I suspect the only way to be certain that you get optimal adventures is with this astonishingly simple code:

Code:
if(have_familiar($familiar[disembodied hand]))
   use_familiar($familiar[disembodied hand]);
cli_execute("maximize adv");
 

zarqon

Well-known member
No it won't. You didn't parse the if statement correctly. The check for a gravy boat only applies when checking if you can dual wield time swords.
 

Miatog

New member
wow, you guys sure are friendly and helpful here. I was expecting to be mocked at like a noob and get like one helpful response. Here I come back and there's a full page of responses of people helping me out.

zarqon, doesn't the maximizer already check for those things?
 

zarqon

Well-known member
Yes -- if you equip your Hand and then run the maximizer, you're guaranteed maximum adventures. What Bale and I have been discussing in our typical OCD fashion is whether we can make some checks first to avoid using the Hand if it's not going to get a time sword put on it, since that would be a needless familiar switch.

I just ran my above code though and discovered that available_amount() does not include your familiars' equipped items, so it didn't use my Hand which already had my time sword on it. Ugh. Just use Bale's code -- it's user-problem-free. Leave me to my overzealous server-hit-preventing machinations. :)
 

Miatog

New member
hehe, thanks a ton for the help. I'm sure I'll get the hang of this some day so I can write my own code.
 
Top