Contest - DC6's Shield Generator

Good day all,

My first attempt at scripting anything, so it's probably not up to scratch. Tried to include a fix for just about any loophole I could come up with, and make it as interactive as possible.

Due to the way that the girl/E.M.U. adventures seem to work, no attempt to run -combat is made.

The script assumes that the user can handle the combats, but if he can't, appropriate hints are given.

Pardon HatrackCheck(), but I've got some fuzzy memories of mafia not working with the hatrack like it should.

Various versions ran on almost ten accounts, worked.



-------------------------------------------------------------------
Change Log (as it seems probable I may tweak this):

v0.7:
- change adventuring from visit_url() to adventure(), and set up the choice adventures accordingly

v0.6:
- add user flexibility for olfaction, suggested form in CCS printout
- fixed guild unlock... bah, why so many noncombats

v0.5:
- added support for the freshly rolled vanilla KoL timer things
- sniffing map-dropping monsters in the consult script... once some mafia issues get worked out, the main script will do the sniffing
- apparently I forgot about the hatrack-less who have feasts, silly me
- temporary solution in the combat consult, as the alien formulas aren't implemented yet
- more code clean-up

v0.4:
- the code got cleaned up a little
- tweak in the consult script to factor in Bale's suggestions (normal weapon attack if possible, and aborting on muscles with ranged weapons)

v0.3:
- dealing with semi-rare counters, auto-aborting... don't ask
- suggesting users turn off any ML they may be running, reinforced if they can't handle it
- filling a certain contains_text, the lack of filling didn't bail the script due to its context
- SGCombatAid remains unaltered from v02, so it stays as v02 for now :p

v0.2:
- option to have the script set you up for combat
- find/make good chefstaff as mysticality class if asked to help prepare for combats
- if a Sauceror with sauce glove, equip the E.M.U. unit in a different slot (if a collision is detected)
- SGCombatAid.ash - consult script. The script spits out an appropriate combat macro to key in

v0.1:
- initial release
 

Attachments

  • DC6_v04.zip
    8.1 KB · Views: 44
  • v01-v03.zip
    20 KB · Views: 44
  • DC6_v05.zip
    8.7 KB · Views: 47
  • DC6_v06.zip
    9.4 KB · Views: 55
  • DC6_v07.zip
    9.3 KB · Views: 48
Last edited:

big_mara

New member
I just tried this script and it worked well. It is a bit irritating that it goes through the questioning every time I use the script, even after a combat aborts, but I would use it again.
 
Version 0.3 - another fix, this time smaller, namely reminding the user that +ML isn't really wanted here. Also aborting if a fortune cookie counter reaches zero.
 

Bale

Minion
Updated. Now has a built-in combat strategy for each class that the user may opt to unleash upon the world if so he desires.

Awesome that you thought of that!

Small criticism: Have you thought of having the script simply attack if the characters attack value is high enough to hit the monster? That would be much less wasteful of mp in many cases.

Second smaller criticism: You might also want to check if the users weapon is ranged type before executing the seal clubber and turtle tamer macros. It's not likely, but...
 

Winterbay

Active member
Small criticism: Have you thought of having the script simply attack if the characters attack value is high enough to hit the monster? That would be much less wasteful of mp in many cases.

Seeing as the monsters are listed with 0,0, and 1 in stats by Mafia I would be interested in how that would work. How would you decide if you can just hit it?
 

Bale

Minion
Oh? I had thought that they were added already. That'd be troublesome then. Not impossible of course since the programmer could calculate them from his own stats, but definitely more than I'd expect from a beginner.
 

Winterbay

Active member
Well, the monsters are in the database but their stats have not been added (so I had to set my unkown_ml to 300 yesterday in order for my consult script to not try and bash their heads in since it tried that with the standard 170 and making me fail by hitting the 30 round limit).
 
The monsters scale, hence the combat options for each of the classes uses class-specific skills that hit a little bit above the usual hit range. The script actually buys the skills for them. This feature is fully optional :p

There's bound to be a cap on those monsters. When I find out what it is, I'll adjust the consult script accordingly.

Regarding the ranged weapon issue - the combat helper aspect of the script automatically slaps a rusty piece of rebar into the main hand of each non-myst character. So it'd be user interference :p valid point, I've got some more aspects of this to tighten up.
 

Winterbay

Active member
The monsters have now been added to the Mafia database so it should be possible to get their stats with the standard monster_<stat>()-functions.
 
Updated. Bale's suggestions have been implemented (har har har, I feel so evil, leaving a ranged-equipped, understatted muscle class to sort the combat out). Also, some code clean-up tweaks. I may clean up the Porko section one day, but it does work the way it is...
 
Version 0.5 posted. This definitely isn't final, as some mafia fixes regarding run_combat() and monster formulas will make for quick improvements in the script, but it works pretty well under the current circumstances.
 
When I adventure normally, with a CCS set up in place and stuff, all is well when I do run_combat(). However, when I try to sniff in the script before having run_combat() finish off, run_combat() instead decides to attack with my weapon. It just by-passes the consult script in the CCS entirely. I have no idea why the heck this is happening.
 

Veracity

Developer
Staff member
So, you set up a CCS which says that "action #1 in the round is to call my consult script" and then your script manually does some other "action #1" before handing control to KoLmafia via run_combat()? And KoLmafia skips the "action #1" in the CCS because, well, you already did an "action #1"?

Suppose action #1 in your CCS was "pickpocket". Your script fetches the fight page, does a pickpocket on its own and then does run_combat() to finish the battle via your CCS. What should KoLmafia do?

I don't have an answer. As far as I know, this is the first I've heard of a script calling run_combat() with a CCS AFTER having done actions in the round. It's not obvious what the correct behavior is, but it's also not obvious to me that it requires "mafia fixes", as you claim.
 
By comparison:

autoadv.ash

void main()
{
visit_url("adventure.php?snarfblat=80&pwd");
use_skill($skill[Clobber]);
run_combat();
}


CCS in mafia:

[ default ]
skill throw shield
skill lunging thrust-smack


result of script trigger:

[925] Orc Chasm
Encounter: Flaming Troll
Round 0: DanceCommander6 wins initiative!
Round 1: DanceCommander6 casts CLOBBER!
Round 2: flaming troll takes 42 damage.
Round 2: Mr. Rodriguez pelts it with a greasy turkey leg, dealing 13 damage.
Round 2: flaming troll takes 13 damage.
Round 2: DanceCommander6 executes a macro!
Round 2: DanceCommander6 casts THROW SHIELD!
Round 3: DanceCommander6 casts LUNGING THRUST-SMACK!
Round 4: flaming troll takes 987 damage.
You gain 6 Meat.
Round 4: DanceCommander6 wins the fight!
You gain 50 Meat
You acquire an item: Trollhouse cookies
After Battle: Mr. Rodriguez smiles a three-lipped smile from beneath the shade of his little sombrero.
You gain 25 Strongness
You gain 7 Wizardliness
You gain 4 Roguishness




Consult CCS:

[ default ]
consult NewConsult.ash
attack with weapon

NewConsult.ash:

void main(int initround, monster mob, string combat)
{
string macro = "skill lunging thrust-smack; repeat";
visit_url("fight.php?action=macro&macrotext=" + url_encode(macro) ,true,true);
}

triggering autoadv.ash yields

[928] Orc Chasm
Encounter: XXX pr0n
Round 0: DanceCommander6 wins initiative!
Round 1: DanceCommander6 casts CLOBBER!
Round 2: xxx pr0n takes 35 damage.
Round 2: DanceCommander6 attacks!
Round 3: xxx pr0n takes 541 damage.
Round 3: DanceCommander6 wins the fight!
You gain 32 Meat
You acquire an item: pr0n legs
You acquire an item: f3d0r4
You acquire an item: lowercase N
After Battle: Mr. Rodriguez smiles a three-lipped smile from beneath the shade of his little sombrero.
You gain 19 Muscleboundness
You gain 8 Magicalness
You gain 5 Cheek


Also, commenting out the line where you use clobber, but keeping the CCS, nets the result of:

[931] Orc Chasm
Encounter: Spam Witch
Round 0: DanceCommander6 wins initiative!
Round 1: DanceCommander6 executes a macro!
Round 1: DanceCommander6 casts LUNGING THRUST-SMACK!
Round 2: spam witch takes 781 damage.
Round 2: Mr. Rodriguez tosses a gob of foul-smelling oyster stuffing at her, dealing 15 damage.
Round 2: spam witch takes 15 damage.
Round 2: DanceCommander6 wins the fight!
You gain 30 Meat
You acquire an item: Spam Witch sammich
After Battle: Mr. Rodriguez smiles a three-lipped smile from beneath the shade of his little sombrero.
You gain 20 Strengthliness
You gain 12 Enchantedness
You gain 4 Smarm


Alas, what the heck?
 
Last edited:
Updated - new guild challenges for dealing with skill buying, and the olfaction+consult issue got kind of walked around by printing CCS patterns that olfact survivors for the user to directly copy, or adapt to his/her taste.
 
Top