Rollover MP

Pazleysox

Member
In trying to update the rollover script that I found, this snippet of code is preexisting. I want to update the script as much as I can. I think I understand what this is doing, but I don't know how to figure out which dwelling = which #... There's a ton of new "houses" since this script was written.

PHP:
	string body;
	body = visit_url("/campground.php");
	int rollMP;
	int ind = index_of(body,"campground/rest")+15;
	int house = to_int(substring(body,ind,ind+1));
	if (house == 0) 
		{	print_html("You will get no <font color=FF0000>Rollover MP</font> without a Campground dwelling - you can buy a tent");  }
			else {
			rollMP = house * 10;
			if (house == 7) 
			{ rollMP = 85; }
			else if (house == 8) 
			{ rollMP = 70; }
			else if (house == 9)
			{ rollMP = 35; }
                 }

Can anyone shine some light on how to find house #'s?
 

lostcalpolydude

Developer
Staff member
It's the URL for the image used for your house. That code won't work any more though, since some housing has 2-digit numbers and that code only looks at the first digit.
 

Pazleysox

Member
It's the URL for the image used for your house. That code won't work any more though, since some housing has 2-digit numbers and that code only looks at the first digit.

Is there a way to get the script to look at multiple numbers?
IE:
PHP:
            { rollMP = 85; }
            else if (house == 15) 
            { rollMP = 70; }
            else if (house == 16)
            { rollMP = 35; }

Or will this still only look at the first number?
 

lostcalpolydude

Developer
Staff member
Unless you're asking someone to hand you some code, you'll need to read and understand lines 4 and 5 of the script, and likely replace them with some regex.
 

lostcalpolydude

Developer
Staff member
Code:
numeric_modifier( get_dwelling(), "Base Resting MP" )
looks like it would work. So you'll be throwing away the entire code block you were starting from.
 

zarqon

Well-known member
Yep. My logout script has this for resting MP:

Code:
numeric_modifier("Base Resting MP") * (100+numeric_modifier("Resting MP Percent"))/100 + numeric_modifier("Bonus Resting MP")
 

Pazleysox

Member
Here's what I came up with
PHP:
string body;
float bart;
body = visit_url("/campground.php?action=inspectkitchen");
boolean [string] numeric_modifier;
numeric_modifier[ "Base Resting MP" ] = true;
	{
	foreach name in numeric_modifier
	{
	if (contains_text(body,"bartinbox.gif")) 
		{		bart = bart + 15;			}
			else
		{		bart = bart + 0;		}
		float mod = numeric_modifier( name );
		float mymod = (my_mp() + mod - my_maxmp() + bart);
	        if ( mod + bart + my_MP() > my_maxmp() )
	{print ("You stand to loose " +mymod+ " MP at rollover, I suggest burning some");}
	else{ print("You will not loose MP");}
    }}}

This works really well. It will give players a print out showing how much MP will be lost at rollover (if any)

I ended up going back to this thread: http://kolmafia.us/showthread.php?802 to help with finding my answer.
 
Last edited:
Top