BRICKOS summoning (hopefully I haven't butchered the ash language!)

RogerMexico

New member
I'm impressed by the coding skill in coming up with those solutions so quickly, but they aren't really necessary. The script never casts the skill multiple times, only once per adventure at most. I'm only regaining 8-12 mp per adventure. Once Brickos have been summoned 5 times, it gets cast less than once per adventure. You don't really need extra code to handle this, the natural progression of Libram cost removes the problem.

So long as you start with your mp 96 less than full, you'd never regen more than your maxmp. Breakfast usually takes care of that for me. An appropriate way to cast the skill several times before starting any adventures is beyond my skill, but that, I think would be the best way to handle excess starting MP.
 

heeheehee

Developer
Staff member
Yep, I know. Just taking care of this corner case (and hopefully saving server hits in the process). Some people might be regaining more (full Hodgman outfit + hamster, for instance). But if you wanted to use this to cast once beforehand, you'd take the chunk out of the while loop, as follows:

Code:
void main( int adv_to_use ) {
	int c = to_int(get_property("libramSummons"));
	int i = 0;
	while(my_mp()-12>(i*(i+1)*(i+2)/6)-(i*(i-1)/2)-(c*(c+1)*(c+2)/6)-(c*(c-1)/2)) {
		i=i+1;
	}
	use_skill(i, $skill[Summon BRICKOs]); 
	while ( adv_to_use > 0 ) {
		adventure(1, $location[Giants Castle]);
		if ( my_mp() > mp_cost($skill[Summon BRICKOs])+12 )
			use_skill(1, $skill[Summon BRICKOs]);
		adv_to_use = adv_to_use - 1;
	}
}

But that's just more code. The calculations don't really take that long, even if you have like 30 million MP. So the original would be more concise.
 

ki77bot

Member
Hi there,

I am trying to use the above code for summoning BRICKOs. That works well...
As I am farming with my NPZR I am generating tons of MP, so I do NOT want to restore, but rather wait until MP is high enough again for the next summon. Until now, only way I could do that is via General -> Preferences and unticking 'Buy items from NPC...' and 'Buy items from the mall...'. Well that works, but my multi is not amused, as those settings are global, i.e. he is not restoring but he should be.

Is there a way to switch those preferences from within an ASH-script? Or maybe another work-around for this problem?

Cheers,
ki77bot.
 

slyz

Developer
Why not set "Do Not auto-recover Mana" in the HP/MP tab? From an ash script, you can do this:
Code:
set_property(  "mpAutoRecovery" ,  "-0.05" );
 

Bale

Minion
Oh, sure. Advise him to deal with the problem instead of a symptom! Like that will help.

Actually he probably just need to turn the level for triggering healing way down, but not necessarily off.
 

ki77bot

Member
Code:
set_property(  "mpAutoRecovery" ,  "-0.05" );

This ^ didn't work, otherwise I wouldn't have turned off the options in preferences.

Well, I understand that I have to manage it with those functions:

string get_property( string )
void set_property( string, string )

But I have NO idea which properties I need to modify...:confused:

edit:

Sorry, I am an idiot, the solution is there, I just didn't get it...Thanks Bale!
 
Last edited:

slyz

Developer
Code:
set_property(  "mpAutoRecovery" ,  "-0.05" );

This ^ didn't work, otherwise I wouldn't have turned off the options in preferences.

You were simply looking for a way to turn off auto-buying? Not a way to stop Mafia from restoring your MP?
Bale's sarcasm is lost on both of us =(
 

ki77bot

Member
Actually I was looking for a way to turn of auto-restoring MP. Turns out you also need to forbid auto-buying.

Ok, here is that particular part of the script...

Code:
	string oldMall = get_property("autoSatisfyWithMall");

if (have_skill($skill[Summon BRICKOs])){
	set_property("autoSatisfyWithMall" , "false");

	int adv_to_use = farm_cycle * 10;

	while ( adv_to_use > 0 ) {
		int c = to_int(get_property("libramSummons"));
		int j = 0;
		while(my_mp()-55>(j*(j+1)*(j+2)/6)-(j*(j-1)/2)-(c*(c+1)*(c+2)/6)-(c*(c-1)/2)) {
			j=j+1;
		}
		use_skill(j, $skill[Summon BRICKOs]); 
		adventure(1, $location[Giants Castle]);
		adv_to_use = adv_to_use - 1;
	}
} else {	
adventure(( farm_cycle * 10 ), $location[Giant's Castle]);
}

	set_property("autoSatisfyWithMall" , oldMall);



This is what happens:

Code:
Putting on $$$ NPZR $$$...
Equipment changed.
Visiting the Mysterious Island Arena...
You acquire an effect: Winklered (duration: 20 Adventures)
A music lover is you.
autoSatisfyWithMall => false
Casting Summon BRICKOs 12 times...
You acquire BRICKO brick (3)
You acquire BRICKO brick (2)
You acquire an item: BRICKO eye brick
You acquire BRICKO brick (3)
You acquire BRICKO brick (3)
You acquire BRICKO brick (2)
You acquire an item: BRICKO eye brick
You acquire BRICKO brick (3)
You acquire BRICKO brick (2)
You acquire an item: BRICKO eye brick
You acquire BRICKO brick (3)
You acquire BRICKO brick (3)
You acquire BRICKO brick (3)
You acquire BRICKO brick (3)
You acquire BRICKO brick (3)
Summon BRICKOs was successfully cast.

One fight inbetween...

Casting Summon BRICKOs 1 times...
You acquire BRICKO brick (3)
Summon BRICKOs was successfully cast.
Searching for "magical mystery juice"...
Purchasing magical mystery juice (17 @ 100)...
You acquire magical mystery juice (17)
You spent 1,700 Meat
Purchases complete.
Using 17 magical mystery juice...
You gain 565 Mana Points
Finished using 17 magical mystery juice.
Casting Summon BRICKOs 4 times...
You acquire BRICKO brick (3)
You acquire BRICKO brick (3)
You acquire BRICKO brick (3)
You acquire BRICKO brick (3)

Should I turn off autoSatisfyWithNPC as well?

edit: Ok that seems to do the trick...

Why is soooo hard to convince Mafia to NOT auto-restore MP? Shouldn't it be sufficient to state 'Do not auto-recover mana'?
 
Last edited:

Bale

Minion
Code:
		int c = to_int(get_property("libramSummons"));
		int j = 0;
		while(my_mp()-55>[COLOR="#ff0000"](j*(j+1)*(j+2)/6)-(j*(j-1)/2)-(c*(c+1)*(c+2)/6)-(c*(c-1)/2)) [/COLOR]
This is your problem. That formula does not do what you want. You should be trying to calculate the cumulate (cost of j+c) - (cost of c), not (cost of j) - (cost of c).

Because of that it is trying to summon way too many Brickos. That's why it wants to restore MP.
 
Last edited:

ki77bot

Member
Hmmm,

I didn't come up with that formula, I only "borrowed" it. As I do not want to dive in into libram summoning mechanics, I don't really want to change it.

But from my testing I can say that it works like that (if autobuying from NPCs is turned off!)

Cheers
ki77bot
 

slyz

Developer
Why simply use cast * bricko between combats? This way mafia will burn your mana on bricko summons and won't try to restore MP because a specific number of casts was asked.
 

Bale

Minion
Oh sure, if you want to keep it simple. The downside is that there is no guarantee that you'll be left with enough MP.

Anyway, I think that the formula should be: (j+c)*(j+c+1)*(j+c+2)/6)-(j+c*(j+c-1)/2)-(c*(c+1)*(c+2)/6)-(c*(c-1)/2))
 

ki77bot

Member
Ok, tested it several times now and it works like a champ...(there was a bracket missing somewhere)

Code:
	string oldMall = get_property("autoSatisfyWithMall");
	string oldNPCs = get_property("autoSatisfyWithNPCs");

	set_property("autoSatisfyWithMall" , "false");
	set_property("autoSatisfyWithNPCs" , "false");

	while ( adv_to_use > 0 ) {
		int c = to_int(get_property("libramSummons"));
		int j = 0;
		while(my_mp()-65>((j+c)*(j+c+1)*(j+c+2)/6)-(j+c*(j+c-1)/2)-(c*(c+1)*(c+2)/6)-(c*(c-1)/2)) {
			j=j+1;
		}
		use_skill(j, $skill[Summon BRICKOs]); 
		adventure(1, $location[Giants Castle]);
		adv_to_use = adv_to_use - 1;
	}

	set_property("autoSatisfyWithMall" , oldMall);
	set_property("autoSatisfyWithNPCs" , oldNPCs);

I always keep enough MP to cast Olfaction and Disco Concentration and Nirvana...

Thanks again guys...
 

Raven434

Member
In your case, you should use the cli version off use_skill, to take advantage of the * (and not have mafia cast 5 times 1 summon, instead casting once 5 summons):

I am getting a strange error message:

You don't have a skill uniquely matching "* summon BRICKOs)"

I just cut and pasted the code from above. Am I missing something?

Thanks.
 

slyz

Developer
cast * bricko is a CLI command. To run it from within an ASH script, you need to do:
Code:
cli_execute("cast * bricko");

As Bale pointed out, this will summon bricko until you don't have any mana left for one more summon, so it could leave you with very few MP.
 

Raven434

Member
Actually, there was a typo in the original script, which is what was causing it to error out.

cli_execute("cast * bricko");

vs

cli_execute("cast * summon BRICKOs)");

And in seeing that line of code, the light bulb went on.

:)
 
Top