Trying to auto-putty ducks

fianor

Member
Daily Script (formerly "Trying to auto-putty ducks")

[Edit]

While my script does "autoputty" ducks, it's not because of anything I did. I'm just using mafia's "putty" function and bounty.ash. As such I've renamed the thread. I think my script has other useful things in it for everyone else and I've still got questions trying to make it "perfect." My questions are later in the thread, but I'm updating the script here, so the one linked in this post is the most recent

[/edit]



These are my daily scripts. The order I go in is this:

Login
Run DWSDailyFarm.ash
manually bounty with putty
Run ducks.ash
manually fight any rotund ducks I could get with spare putty after the 10 farm adv
Run CastleFarm.ash
Shrug any leftover cantata, request Ode from wherever, usually testudinata
Run Logout.ash

DWSLib.ash has a few functions I call throughout my other scripts and cleanup.ash I keep separate from logout.ash so I can on occasion run it without resetting everything else.

I'd like to make this all work as one script that I simply make my login script in mafia but there are a couple things I can't figure out how to do.

First, how do I make mafia choose the third bounty option automatically and then go get the bounty.

2nd, how to get mafia to putty & olfact the 1st rotund duck, should it come across one, fight the 10 daily ducks and only after that, fight any putty ducks I can.

Any idea would be great, and if you see something just bad or that could be better in one of the scripts suggestion are of course welcome.
 

Attachments

  • DWSDailyFarm.ash
    13.4 KB · Views: 50
Last edited:

Camber

Member
For getting the bounty, you want to use bounty.ash. It won't putty monsters, the puttying is done by your CCS and betweenBattleScript. FirstThingsFirst.ash puttys the monster, but it then requires BestBetweenBattle.ash to use the putty. You will also need canadv.ash and zlib.ash. Each of these scripts is linked by name.

Here is how you use it:
Code:
bounty.ash list		[list today's bountys, useful to see, but not required]
bounty.ash accept 3	[accept bounty #3]
bounty.ash hunt		[or *, uses all your advs until the hunt is successful]


I use it in my login.ash script like this:
PHP:
cli_execute("call bounty.ash accept 3") ;
cli_execute("call bounty.ash hunt") ;



Ducks are for someone else...
 
Last edited:

slyz

Developer
For the puttying and olfacting part, simply add
Code:
cli_execute("olfact monster Rotund Duck");
cli_execute("putty monster Rotund Duck");
before fighting ducks, and make sure your combat action or consult script will follow those settings (smartstasis follows them).

Once you are done, simply loop this to fight the remaining copied monsters:
Code:
cli_execute("putty monster Rotund Duck");
use(1, $item[Spooky Putty monster]);

I'll leave it up to you to add checks for the number of copies you can still make, and make sure you don't have a puttied monster before you start etc...

You can check out this script for inspiration.
 

fianor

Member
Ok so I've adjusted my scripts with the suggestion and am currently using the bounty.ash et al. However, this shit is REALLY slow now. I guess I'm going to have to go through and remove every function in bounty.ash, FirstThingsFirst.ash, BestBetweenBattle.ash & canadv.ash that aren't specifically being called or that I don't have need of using. Also, I think each and every one of these scripts imports zlib.ash. Can that be removed from some of them? Does it effect memory use for libraries within libraries to be calling other libraries? Seems like it could cause some slow downs to me at least.

Anyway, running my scripts as I had them worked really fast and well, just required my input for a couple of things I thought I could automate. Using these other scripts and settings have now made mafia unstable and incredibly slow. Any ideas on what could be the issue are more than welcomed. I've attached my current scripts in case anyone wants to see what's going on.

The goal is to just run DWSDailyFarm.ash and be done. It imports DWSLib.ash and makes a call to cleanup.ash. My CCS is generally consult FirstThingsFirst.ash then fight.

betweenBattleScript=BestBetweenBattle.ash, but I modified BBB to import NeoLibram.ash and make the call to run it in the main so I use my generated mana on Brickos. I also commented out the cookiecheck function and the call to it in bbb as I do not ever want to waste fullness on a cookie.

So basically an adventure goes like:
adv wherever
monster comes up
r1 - call FirstThingsFirst.ash (importing zlib)
r2 to r30 - attack until monster is dead
call BestBetweenBattle.ash (importing zlib & NeoLibram which also imports zlib)


My other issue is trying to get the script to use my (or any I guess) counter to mark what portions of the script have run and which have not. That way if something crashes out, I can run it again and it will not try to redo what it's already done. The counter function in it now (DWSStatus in DWSLib.ash) compares a variable (DWSAdvToday) from properties and will crash out for me to prevent the script from redoing a section it's already done, each section begins by testing against the variable and ends with a function to increment the variable by 1. The biggest problem I seem to be having is that I am using an 'abort ("YouSuck");' type call to stop the function from continuing, which of course cancels the entire farming script. I've been trying to convert that to a break type function but am either completely misunderstanding how it works or something as I can't get break to work.
 

Attachments

  • DWSDailyFarm.ash
    11.6 KB · Views: 33
  • DWSLib.ash
    2.2 KB · Views: 33

slyz

Developer
Is the actual script execution slow, or is it simply the combats that are slower because Mafia is handling them round-by-round instead of generating a KoL Macro?

Maybe you should use a simple CCS with special sections for monsters you want to olfact, instead of using FTF. Or simply set a combat action and tweak the autoPutty and autoOlfact properties before combats.

Also, as far as I know, if multiple script import the same library, it will be loaded only once.

EDIT: instead of aborting, you should simply return.
 
Last edited:

fianor

Member
Not 100% sure yet but the combats are definitely slow, but the script seems a touch pokey also. My first attempt at this was to use a combat action in the scripting e.g.:

adventure(5 , $location[giant castle], "olfact_goth");

But I then realized I'd have to write case's or a bunch of consult scripts for each monster. I was unaware of mafia's built in putty and olfaction functions. I'm looking for how to properly use those now with or without FTF and BBB as required.

zlib Loading once would make sense but I could see how it'd load each time also. I'd like to see a confirmation but I trust you're right about it.

Using exit didn't do anything different than abort, except disallowing a message, and I've thus far completely failed to be able to get return to ever work in any script in any way. I'd assumed it was the right function to use but I couldn't get it to work.

What I have done is change the counter function to this boolean:

Code:
boolean DWS_status (int DWSStatus){
	if ((to_float(get_property("DWSAdvToday"))) > DWSStatus) return true;
}

and change all the functions in my farm script to this format:

Code:
void DWS_test () {
	if (DWS_Status(0)) print ("You have already done parts 1&2 today");
	else {
		set_property( "DWSAdvToday", 1 );	
		print ( "running part 1");
		print ( "running part 2");
	}
}

which works beautifully. So the only thing I'm looking to figure out now is speed. I'm attaching the current scripts I'm running in case anyone wants to look over them.

View attachment DWSDailyFarm.ash
View attachment DWSLib.ash
 

slyz

Developer
Sorry, I thought you meant to abort a script but allow another one to continue - in fact you simply wanted to return from a function. Your way works, I usually do this:
Code:
void DWS_test () {
	if (DWS_Status(0)) return;
	set_property( "DWSAdvToday", 1 );	
	print ( "running part 1");
	print ( "running part 2");
}
 

fianor

Member
I don't know the custom on these forums yet. Other than for historical value, all this is completely irrelevant now as my script no longer resembles any of this much at all. I do have questions on the new script which started out as this one. Should I start a whole new thread, edit the first post (surely not since that obviously confuses the hell out of anyone that reads posts 2-7), or just start where I left off in this thread?

If I should start a new one do I need to notify a mod somewhere that this one should/can be closed/archived or something?
 

Winterbay

Active member
As far as I'm aware very few threads on these forums ever gets closed. I think I've seen one so far. If the new script is completely different then I'd say to start a new thread, if it shares some common things then why not continue in this one? :)
 

Theraze

Active member
I've commented in one that got closed. :D

If the first post/script is useless, feel free to wipe the scripts/attachments you had there. What most people who wander in later will be curious on is the finished product, not the one that got rejected. As long as the text in the first post matches the script, nobody here seems to really care what comes between first and finished. :)
 

Grotfang

Developer
If it does the same thing, post it here. If it is for something different, start a new thread. Don't worry too much about the similarity of the code -- people search for certain functionality, not particular lines of ASH text.
 

fianor

Member
Ok, so I've removed all the crap and just linked the script in the first post and made a note so the thread makes sense again. At least to me.

I have a todo list in the script header that are what my questions are about:


1) How do I test if bounty #3 is the mechs. I want to equip the bone spurs for +20ML to guarantee the mech fight from the choice adv if it is. My bounty scripting already putties the bounty monsters, olfacts it, and runs away from everything else with the GApants. I'm trying to minimize adventure use on picking up the lucre and this is only thing I can think of that might save a turn or two if I run into the choice adv before the mech. (I average using 8 adv per lucre btw)

2) how can I test for active AT songs and shrugs anything that isn't polka or phat. Most of the time for me this is only going to be cantata or ode, but occasionally I get randomly buffed by others and want to ensure someone being nice doesn't wind up crashing out my scripts.

3) How do I make a timer for the choice popups so it auto chooses to continue after x amount of time. I have 5 points where the script asks me for input.

a) if I'm farming for sand dollars today.
b) do I want to bounty hunt
c) do I want to kill ducks
d) do i want to farm the castle
e) am I done for the day (should it overdrink and change into my pajamas)

I want it to pop up and ask, but I want it to just go ahead and choose yes if I don't respond in 10 seconds or so. Basically I want to be able to just start mafia and run out the door on days that I'm in a hurry, but want to pick and choose which bits to do on days that I have more time.




... I changed the first post title hoping it would fix the thread title ... it didn't .... meh
 

heeheehee

Developer
Staff member
Don't suppose we can do that purely with Mafia currently -- that'd require a modification to user_confirm() (an overloaded form?), I presume. The only way I can envision this working is if you rewrite this into a UI script, using JavaScript for prompting, then reloading the page with whatever getdata attached. Overall, really ugly and messy.
 

fianor

Member
That is not what I wanted to hear, hee. Try again, but this time say something like "use timed_user_confirm("This is awesome, you rule", 30);"
 

tgetgel

Member
1) How do I test if bounty #3 is the mechs. I want to equip the bone spurs for +20ML to guarantee the mech fight from the choice adv if it is. My bounty scripting already putties the bounty monsters, olfacts it, and runs away from everything else with the GApants. I'm trying to minimize adventure use on picking up the lucre and this is only thing I can think of that might save a turn or two if I run into the choice adv before the mech. (I average using 8 adv per lucre btw)

I still have to use the putty monster manually (haven't figured that part out yet - I must be missing a setting or something - might be the ccs), but I never need to run away - Once I have a putty monster, I use the putty monster, try to pickpocket, then use the putty sheet and fight the monster. Repeat until goal met.

Edit: Oh, I get it, you run away from everything at the beginning until you find the right monster.
 
Last edited:

Theraze

Active member
Also, would it be possible to have a mod fix the title so that it matches the first post? That should make things less confusing in the future. :)
 

slyz

Developer
1) How do I test if bounty #3 is the mechs.
PHP:
if ( get_property( "currentBountyItem" ).to_item() == $item[ burned-out arcanodiode ] )

2) how can I test for active AT songs and shrugs anything that isn't polka or phat. Most of the time for me this is only going to be cantata or ode, but occasionally I get randomly buffed by others and want to ensure someone being nice doesn't wind up crashing out my scripts.
Take a look at this thread, you should find everything you need.


I still have to use the putty monster manually (haven't figured that part out yet - I must be missing a setting or something - might be the ccs)
PHP:
use( 1, $item[ spooky putty monster ] );
Simply make sure your CCS will re-putty, and you can add a "while" to repeat the process.
 

fianor

Member
I still have to use the putty monster manually (haven't figured that part out yet - I must be missing a setting or something - might be the ccs), but I never need to run away - Once I have a putty monster, I use the putty monster, try to pickpocket, then use the putty sheet and fight the monster. Repeat until goal met.

Edit: Oh, I get it, you run away from everything at the beginning until you find the right monster.

my "puttyfarm" ccs has a section for each bounty dropping monster and then a default, like this

Code:
[ default ]
try to run away

[ *name of the bounty dropping monster* ]
consult FirstThingsFirst.ash
attack with weapon

and this is the bounty hunting section of my script

Code:
void DWS_Bounty () {
  if (DWS_Status(5))
	print("You've already visited the bounty hunter today", "green");
  else {
	set_property( "DWSAdvToday", 6 );	
	if (!user_confirm("Do you want go bounty hunting?"))
		abort("OK then, you've got adventures to burn.");
	outfit("bounty");
	use_familiar( $familiar [sandworm]);
	cli_execute("bounty.ash accept 3");
	if (get_property("currentBountyItem").to_item() == $item[burned-out arcanodiode] )
		equip($slot[acc3], $item[bone spurs]);
	if (get_property("currentBountyItem").to_item() == $item[discarded pacifier] )
		if (user_confirm("Are you also duck hunting today?")) DWS_ducks();
	else
		cli_execute{
			ccs puttyfarm
			bounty.ash hunt
			olfact monster none
			putty monster none
		}
	}
}

It's FirstThingsFirst.ash and BestBetweenBattle.ash that actually do the controlling of the putty use. I was trying to write it to do this all in my script, but have decided that using what's alreadybeen done by others is my best option for now. I am however studying these 2 scripts and trying to rewrite them for me. I wouldn't care, but the adventures run so much slower when I am using FirstThingsFirst.ash. BestBetweenBattle.ash doesn't seem to be causing any real slowdown. I also use a modified neoLibram.ash called from within BestBetweenBattle.ash. Since my normal outfit generates so much MP I want to burn it on brickos and I can't get anything else to do it so I forced it to.

The neoLibram.ash is modified with this at the end, just before the void main:

Code:
if(have_equipped($item[stinky cheese eye]))
  print("Your eye already stinks.", "green");
  else if((to_float(get_property( "_stinkyCheeseCount" )))> 33)
	{
		cli_execute("fold stinky cheese eye");
		equip($slot[acc3], $item[stinky cheese eye]);
		equip($item[staff of the deepest freeze]);
	}
  	else print("Count is at " + get_property( "_stinkyCheeseCount" ) + " Lets Keep the natty for*now.", "green");

if ((to_float(item_amount($item [3666]))) == 1)
	print ("You're out of putty", "green");
	else
		if((to_float(get_property( "spookyPuttyCopiesMade" ))) == 5 && (to_float(item_amount($item [3665]))) == 1) 
			cli_execute("fold Spooky Putty snake");
		else
			print ("Putty Monsters still available", "green");


these are in there because it optimizes meat gain a bit. I probably need to rework these now that I know more about ash. Also I'm not sure that i need the putty section of this any more. My old CCS called for using putty and crashed things out when I had no more uses left and it tried to use it anyway.

Now that I've said all that, look at the FARM DUCKS section of my script and you can see how to make mafia putty a single monster. Since I didn't want to write all that for each bounty monster, I just use FTF and BBB for now. Also I didn't want to rewrite FTF or BBB which is why I wrote this bit for the single monster they don't putty for me.

Hope that's of some use
 

Theraze

Active member
When you have the 'attack with weapon' after a consult, it can't macrofy it, so it's slower... Try following zarqon's suggestion and putting in a macrofied attack consult after the initial consult. The FTF/SS part is still normal speed, but after it finishes up, the actual combat is just as fast as it would have been.
 

fianor

Member
uhm ... that doesn't seem to help in any way. Mafia's inability to macrofy (according to it's cli message)

Code:
[103259] An Octopus's Garden
Encounter: octopus gardener
Strategy: H:\Mafia\ccs\default.ccs [default]
Round 0: fianor wins initiative!
(unable to macrofy due to action: consult firstthingsfirst.ash)
Round 1: fianor executes a macro!
Round 1: fianor attacks!

is due to the consulting of Firstthingsfirst.ash, not from the attack. I used this CCS

Code:
consult firstthingsfirst.ash
consult spamattack.ash

and it is absolutely no quicker than,

Code:
consult firstthingsfirst.ash
attack

which results in a cli response of

Code:
[103260] An Octopus's Garden
Encounter: Neptune flytrap
Strategy: H:\Mafia\ccs\default.ccs [default]
Round 0: fianor wins initiative!
(unable to macrofy due to action: consult firstthingsfirst.ash)
Round 1: fianor attacks!

so I don't really see how that's supposed to help speed things up. I see that the spamattack results in the round 1 message of executes a macro, but the adventure runs no quicker at all. How is the supposed to be speeding things up? I believe the linked thread stated it is nicer to the server, so it's probably better to use spamattack, but it does not speed anything up as far as I can tell. The speed issue, as far as I can tell seems to be with FTF.
 
Top