First Things First -- a multipurpose pre-combat consult script

Status
Not open for further replies.

zarqon

Well-known member
[size=+1]First Things First 4.0[/size]

First, an IMPORTANT NOTICE: This script is no longer being developed or supported. All of its functions have been absorbed into the new SmartStasis as of SS 3.0 (link in my sig below). The new SS is highly superior to this old thing, and I highly recommend you give it a try! ~Z~

What does it do?
FTF is a consult script for handling some of those things you might want to do before attacking and killing monsters. Currently, FTF handles:

  • Stealing from weaker monsters whenever you can (twice if you have the ability to).
  • Using Entangling Noodles on stronger monsters if you can.
  • Using Olfaction on the monsters you specify in ftf_olfact, as well as bounty monsters when you are on a bounty hunt!
  • Puttying bounty monsters (for bounties requiring at most puttybountiesupto items).
  • Appropriately summoning Pastamancer ghosts depending on type and experience level!
  • Salving yourself if you need it or it's better than your out-of-combat restore options.
  • Using the Big Book of Pirate Insults on pirates in the Cove/Barrr if you haven't learned all the insults yet.
  • Using spooky putty on lobsterfrogmen if you haven't completed that sidequest yet.
  • Using specific items against the mini-bosses in the Cyrpt.
  • Throwing flyers and/or hand mirrors against the Guy Made of Bees.
  • Throwing flyers and/or yet-unthrown base pairs at Cyrus the Virus.
  • Throwing flyers at everything you can if you have flyers (if flyereverything is true).
  • Throwing meat vortices at thieving brigands.
  • Throwing skate decoys at groupers/urchins to get goal familiars.
  • Throwing cocktail napkins to drive away clingy pirates if clingfilm items are not goals.
  • Using your Major Yellow Ray on the monsters specified in ftf_yellow if you have a He-Boulder as your familiar.
  • Casting Creepy Grin or Stinkeye on the monsters you specify in ftf_grin if you're wearing the appropriate accessory.
  • Identifying bang potions and hidden city spheres (transparent with mafia settings). In the case of bang potions, it will always ID potions if you have more than one.

NOTE: Weaker / stronger monsters are calculated based on the monster's attack (plus threshold) vs. your moxie. Unknown monsters are assumed to have a monster level of unknown_ml.

ALSO NOTE: All script settings mentioned above (in teletype font) can be adjusted by typing "zlib settingname = value" in the CLI. Type "zlib vars" in the CLI to see the current values. These values do not change when updating the script!

ALSO ALSO NOTE: If you are on a hunt, Olfaction will ignore ftf_olfact monsters in the bounty location, only olfacting bounty monsters. Outside of the bounty location, specified monsters will still be olfacted. Puttying will also take place against bounty monsters for bounties requiring up to puttybountiesupto items (default is 19). For puttying to be effective, you also need something that will fight your spooky putty monster after creating it. I recommend the Best Between Battle Script Ever!

Both Olfaction and puttying are sensitive to mafia's one-time olfaction/putty combat settings, so I'm fairly certain that including "special action" in your CCS is unnecessary.

How to use it:

  • Download FirstThingsFirst.ash to your scripts directory.
  • Also, make sure you have ZLib.
  • Optionally, adjust any settings you wish to adjust (mentioned above).
  • Include something like this at the top of your custom combat script:

Code:
[ default ]
1: consult FirstThingsFirst.ash
2: attack

  • Remove Olfaction, Noodles, stealing, Creepy Grin, Cyrpt bosses, flyers, Cyrus, and GMoB from your existing ccs. They are no longer needed.
  • ...
  • Enjoy!

Changelog
5.29.08 - ver. 1.0 posted.
5.30.08 - ver 1.1 changes: added handling for the Big Book of Pirate Insults in Barrrney's Barrr.
6.09.08 - ver 1.2 changes: included automatic safe summoning of Pastamancer combat ghosts. Included Cyrpt mini-boss special item throwing. Bumped default threshold up to 4.
6.10.08 - ver. 1.3 changes: changed "get the jump on" to just "get the jump" due to a sword that sometimes messed things under.
9.17.08 - ver. 1.4 changes: edited the script so as to avoid borking on unknown monsters (thanks to Paulie Astaire for the fix).
11.24.08 - ver. 1.5 changes: no longer assumes you are safe against unknown monsters if your moxie is over 200. Added special handling for GMOB.
11.28.08 - ver. 1.6 changes: uses "safetyThreshold" property for per-user safety settings.
12.20.08 - ver. 1.7 changes: add support for Creepy Grin. Ask whether you'd rather use flyers or mirror in rare situation against GMOB when you have both but must pick one.
1.04.09 - ver. 1.8 changes: default to (facsimile) dictionary in the Chasm. Clear poison if you have anti-anti-antidotes and they get you in the first few rounds (thanks Bale!). Cast Salve on yourself if you need the HP (thanks dj_d!). Added sponge to olfacted monsters.
1.27.09 - ver. 1.9 changes: fix handling Olfaction of bounty and non-bounty monsters in the same zone (thanks tebee!). Add meat vortex for brigands to accommodate upcoming OCW change. Rearrange a few things to allow it to play nice when imported into other consult scripts.
3.12.09 - ver 2.0 changes: FTF should play nice with stealing and noodles combat "special" settings. You are not "in the clear" if you are Strangulated. Save a meat vortex in case you need one for the NS tower. Detect hobo monkey theft for use if imported into another CCS.
3.30.09 - ver. 2.1 changes: mafia tries to cast Lasagna Bandages through the skills URL rather than in-combat, causing an error. Use visit_url() rather than use_skill() for that particular skill.
4.25.09 - ver. 2.2 changes: use spooky putty on lobsterfrogmen during the quest if you don't have enough gunpowder.
4.26.09 - ver. 2.3 changes: move puttying to its own function. Add a few lines to putty a fithworm guard if you are on your last adventure of stench (commented out by default).
5.06.09 - ver. 2.4 changes: detect hobo sobriety for use by SmartStasis (ghost detection still needs work). Make poison removal behavior exactly match your combat setting. Swap order of mirror and flyers vs. GMOB with funkslinging.
5.13.09 - ver. 2.5 changes: finally, detect Gluttonous Green Ghost hunger! Don't ever cast Noodles if you're in the clear. Improved handling vs. GMOB in the event that you throw the flyers without Noodles and survive.
6.09.09 - ver. 2.6 changes: added a flyereverything option. If true (default), will throw flyers at everything unless you are a) on the battlefield, or 2) in the haunted bathroom. Attempt to use Noodles before flyering or insulting, even if in the clear. Moved insults into use_special_item(). Account for Hero of the Half-Shell when checking intheclear().
6.14.09 - ver. 2.7 changes: moved some functions around -- now requires ZLib. Now has once-daily version checking.
7.10.09 - ver. 2.8 changes: allow pickpocketing in Form of...Bird! Introduce framework for possible, eventual auto-olfaction/puttying.
7.25.09 - ver. 3.0 major update! Completely refactor Olfaction (and introduce puttying) of bounty monsters, by using the data file generated by bounty.ash. Now only reserves Olfaction for bounties if you are in the correct location. Use script settings rather than variables. Use as many miniboss combat items as you have, rather than just one.
8.06.09 - ver. 3.1 changes: Introducing smart PM ghost summoning! Now has individual logic for each ghost type, to decide whether or not to summon.
8.25.09 - ver. 3.2 changes: much simpler detection of when to steal. And a few additions for the Primordial Soup: add violent fungus to Olfaction list. Handle throwing base pairs at Cyrus.
11.7.09 - ver. 3.3 changes: added transparency for several more mafia settings: autoOlfact, autoPutty, and autoPotionID. Move olfacted/grin monster lists into ZLib settings. Don't require intheclear() for summoning PM ghosts. Handle GMoB and Cyrus with most of the same code (flyering or throwing the appropriate item, with funkslinging support).
11.28.09 - ver. 3.4 changes: fixed use of "monster monstername" for puttifaction. Move detection and response to gremlins with tools/megalopolis monsters with discs here.
12.30.09 - ver. 3.5 changes: abort if your rusty item gets slimed in the Slime Tube. Refactored special item function. Use skate decoys to get familiars if they are goals. Use cocktail napkins against clingy pirates if no clingfilm items are goals. Auto-ID spheres transparently with mafia setting. Use ZLib's new vprint().
1.23.10 - ver. 3.6 changes: use ZLib's new load_current_map() to get the bounty data. Always ID bang potions if you have more than one -- otherwise, follow the setting. "zombie waltzers" => "some zombie waltzers"
4.1.10 - ver. 3.7 changes: a frigton.
4.6.10 - ver. 3.8 changes: fixed embarrassing typo that crept in with other changes, causing intheclear() to always return true. Incorporated ASH's new item_drops_array() into monster value calculations. Fix detection of clingfilm goals when deciding whether to throw cocktail napkins at clingy pirates.
4.19.10 - ver. 3.9 changes: added Yellow Ray support against monsters specified in new setting ftf_yellow. Don't insult pirates from the F'c'le or beyond. Remove ghostname variable. Better pickpocketing calculations.
4.25.10 - ver. 4.0 changes: has_goal() now returns a float. If olfacting for goals, olfact the monster with the greatest chance of yielding goals. Don't flyer if flyeredML >= 10000.
4.08.11 - They day has arrived: FTF has finally been obsoleted by the new SmartStasis. Removed version checking from FTF, since no updates will follow.
 

Attachments

  • FirstThingsFirst.ash
    23.1 KB · Views: 222
Last edited:

Paulie Astaire

New member
Great script!

I went ahead and changed the line in class_action() from "You get the jump on " to "You get the jump " because it was being broken by Sword Behind Inappropriate Prepositions.
 

Rinn

Developer
I don't think this works if you fight a monster because of a choice adventure. For example, in the gallery I get this ouput when fighting a snake knight:

Code:
[493] Haunted Gallery
Encounter: Out in the Garden
Encounter: knight
Strategy: C:\Documents and Settings\jkirchoff\My Documents\My Files\KoLmafia\ccs\default.ccs
Bad monster value: "knight"
You're on your own, partner.

I got a similar error when fighting animated nightstands in the bedroom.
 

Paulie Astaire

New member
[quote author=Rinn link=topic=1739.msg8657#msg8657 date=1218131539]
I don't think this works if you fight a monster because of a choice adventure. For example, in the gallery I get this ouput when fighting a snake knight:

Code:
[493] Haunted Gallery
Encounter: Out in the Garden
Encounter: knight
Strategy: C:\Documents and Settings\jkirchoff\My Documents\My Files\KoLmafia\ccs\default.ccs
Bad monster value: "knight"
You're on your own, partner.

I got a similar error when fighting animated nightstands in the bedroom.
[/quote]

I have the exact same problem with that adventure, but assumed it was Mafia and not related specifically to this script. I think the names of the knights were changed and Mafia's database hasn't been updated, which is why you're getting a window saying Mafia lost sync-- it encountered a monster it's never seen before instead of what it expected, so it stops.

I posted about this in the main Mafia thread on the KoL forums but never heard anything back. I'll dick with the monsters file manually next time I make it around to the Gallery and see if it does anything.
 

Paulie Astaire

New member
There are a couple of functions I'd like to add to this script, and I'm not 100% sure how to do it. If this isn't the place to discuss this just let me know and I'll move over to the Discussion forum.

I'd like to make it so that if the monster you're fighting has defense that is too high for you to hit or defense == 10[sup]*[/sup]-- whether Muscle or Moxie depending on weapon-- and if you also have 2 toy deathbots, or 2 mercs, or 2 destroy-o-bots, it will noodle and then funksling those instead of trying to melee or plink. As it stands I sometimes use this strategy at higher levels with myst classes in tedious places like the island war, and it's really really really irritating having to click through all that when you've spent the first 10 levels doing auto-everything. I've found that the more I have the click, the more I start getting irritated with the game. :p

I'd also like to figure out how to fix it so that fighting one of the knights in the In The Garden choice adventure when you already have Dreams & Lights will not break automation and pop up a request for synch. This makes grinding stats in the gallery very irritating!

Any tips on how to do these things would be greatly appreciated.

*: I say "if defense == 10" because this seems to be the value Mafia uses for higher level monsters with unspaded defense. Since I only ever sling bots as high level Myst classes during the level 11 and 12 quests, this would never actually be a problem for me specifically on low level monsters whose defense really IS 10.
 

zarqon

Well-known member
@Rinn, Paulie: I had assumed the knight problem was a mafia monster database issue which would be resolved, but I believe it is a special case for which special handling may be required. I agree that this issue is an annoyance and I will attempt to solve it when I am home on a break Sept. 15th.

@Paulie Astaire: Your suggestion, while good, is outside the scope of this script as far as I'm concerned. This script is for pre-combat actions that need doing, so your CCS can handle combat for you after this script takes care of all the pre-combat stuff. But if you would like to modify your FTF to automate some combat, go for it. You can save time by using FTF's intheclear variable, which is true if you outmoxie a known monster (false for stronger or unknown monsters). Something like

PHP:
if (!intheclear && item_amount($item[toy deathbot]) > 1)
  throw_items($item[toy deathbot], $item[toy deathbot]);

after noodles.

Also, stats for unknown monsters is 0. I'm guessing your MCD was set to 10, which is why mafia said the monster's level was 10.
 

Paulie Astaire

New member
Fixed the knight issue. I changed main() in FirstThingsFirst.ash to:

Code:
void main(int initround, string foe, string url) {
  round = initround;
  boolean intheclear = (monster_attack() < my_buffedstat($stat[moxie]) - 6 + threshold);
  if ((monster_attack() - monster_level_adjustment() == 0 && my_buffedstat($stat[moxie]) < 200) || foe == $monster[none]) 
   intheclear = false;
  if (intheclear) {
   url = class_action(url);
  } else url = handle_noodles(url);
  handle_olfaction($monster[foe],url);
  if (my_location() == $location[barrrney's barrr]) handle_insults(url);
  use_special_item($monster[foe],url);
  if (round == initround) url = attack();
}

Note that with this change, if you encounter a mob Mafia doesn't know about, it will automatically assume the worst and intheclear will be false.

There may or may not be a better, cleaner, or more efficient way to do this, but this works for me.
 

zarqon

Well-known member
Updates! Woot!

  • [li]Fixed an error which could occur infequently with the Guy Made of Bees when you have both flyers and an antique hand mirror, but don't have funkslinging or entangling noodles.[/li]
    [li]Added support for Creepy Grin. Not a big deal, but something else that is nice to have handled intelligently. You can specify which monsters you want to Grin at, and if you encounter one of those monsters and you are wearing the V mask, it will cast Creepy Grin, if you haven't used it up for the day.[/li]

EDIT: removed now irrelevant bit about editing script to save server hits, to avoid user confusion.
 

Bale

Minion
[quote author=zarqon link=topic=1739.msg10572#msg10572 date=1229768700]
1) add this line somewhere in your login script:

CLI version: set creepyGrinUsed => false
ASH version: set_property("creepyGrinUsed","false");

[/quote]

Interesting solution to the problem. But how does that work if you log in twice in a day? Won't it reset to false again?

Rather than use a separate login script, I get around the issue of doing things once a day by using a line like this in my scripts: set_property("Last_Zap", moon_phase()); Then I just check to see if today's moon phase matches the last time I did it. Sure, if I run the script exactly 16 days after its previous usage, then it will mistakenly think it already acted that day, but I figure that is extremely unlikely for a script I run every day.
 

zarqon

Well-known member
That's a perfectly viable solution (btw -- using today_to_string() instead of moon_phase() would take care of your 16 days issue), but I really hate adding properties to settings. I think creepyGrinUsed is useful and should probably be in mafia already, but adding yet another setting just as a flag is something I personally like to avoid. YMMV.

And yeah... multiple logins will reset it to false, but the consequence is just one extra server hit, not a huge deal. Still better than running the script unedited.
 

Bale

Minion
[quote author=zarqon link=topic=1739.msg10576#msg10576 date=1229769657]
That's a perfectly viable solution (btw -- using today_to_string() instead of moon_phase() would take care of your 16 days issue), but I really hate adding properties to settings. I think creepyGrinUsed is useful and should probably be in mafia already, but adding yet another setting just as a flag is something I personally like to avoid. YMMV.

And yeah... multiple logins will reset it to false, but the consequence is just one extra server hit, not a huge deal. Still better than running the script unedited.
[/quote]

Thank you! I was completely unaware of today_to_string(). I'm going to have to change that in my aftercore breakfasting script.
 
Another solution to the Creepy Grin issue is to check the text of the page. Since Creepy Grin only appears in skills drop down if you can actually cast it, you can use page.contains_text("value=\"7015\" picurl=\"waxlips\" >Creepy Grin (") to perform your check instead of messing with settings or server hits.

It does make the script vulnerable to server-side changes (in fact, writing this post helped me discover that an old script of mine that did this was broken by the Combat Action Bar), but that's rare and easily fixed.
 

zarqon

Well-known member
*facepalm*

Okay, so only four people d/led 1.7 so far. I've now uploaded a version that uses contains_text() for detecting Grin availability rather than mess with settings, but I didn't want to change the version number since there is no new functionality. So:

Hey 4 people! d/l it again! If you've already run it, delete the "creepyGrinUsed" line from your settings file when mafia is not running.
Hey everyone else! Ignore the bit about editing the script to save server hits! Just download it and it will work.

Thanks bigevildan!
 

Ethelred

Member
[quote author=zarqon link=topic=1739.msg10576#msg10576 date=1229769657]
That's a perfectly viable solution (btw -- using today_to_string() instead of moon_phase() would take care of your 16 days issue), ...
[/quote]

I've wondered about about using today_to_string() in a scipt to insure something only get done once per day, but was concerned about the window between rollover and midnight. If I run my normal session during the day and invoke the once per day function and then run it again after rollover, but before midnight, will the second invocation fail? Guess I should just make a test program and try it out, but being lazy, thought I'd ask first.
 

zarqon

Well-known member
I'm not sure if mafia's today_to_string() is based on your computer's calendar date, or KoL's rollover time.

To be safer, you could a) use visit_url() to parse the side panel when you login and get the KoL date, or 2) use these functions, which are similar except they return a KoL date (i.e. "Bill 4"), with rollover happening at 10:00pm CST.

EDIT: As I have moved to Korea since writing this post, I can confirm that today_to_string() is not based on your computer's time, but rather the KoL day, which is far more useful. Excellent!
 
Last edited:

dj_d

Member
I added a version that will use saucy salve to heal you if needed as well.
 

Attachments

  • FirstThingsFirst.ash
    5.3 KB · Views: 63

zarqon

Well-known member
@dj_d: That's a good suggestion -- I don't think I've been a Sauceror since writing this script, so it didn't even occur to me.

You apparently edited an older version of the script, so I went ahead and added salving to the latest version. But I opted not to make the script salve more than once per combat. If you are in a safe zone, you will eventually be restored. If you are not, you will not want to salve more than once anyway. If you are using a restorative familiar, this also leaves greater opportunity for it to help you, as well as being more conservative of MP.

Thanks for improving the script!
 

Stardock

Member
Nice script. I wonder how hard it would be to extend it to use the spooky putty sheet on the monsters first instead of olfaction. Might cut down on a few turns per day.
 

zarqon

Well-known member
I assure you, spooky putty will be implemented in FTF if at all possible. But right now I'm in HC and can't test it out.
 
Status
Not open for further replies.
Top