visit_url doesn't seem to return any data when visiting Port Beginning

ereinion

Member
I am trying to write a small script to farm FunPoints, and in doing so I want to examine the various choices I get at various point during the journey through PirateRealm.

So far I have this snippet, but when I look at the file in my data folder after running it, it is empty although I have entered the Port Beginning choiceadventure.

Is there a reason visit_url doesn't return the html for the adventure, and is there a way I can circumvent this?

HTML:
void main() {
    string[int] s;

    if (item_amount($item[PirateRealm eyepatch]) <= 0) {
        visit_url("place.php?whichplace=realm_pirate&action=pr_port");
    }
    
    if (item_amount($item[PirateRealm eyepatch]) > 0) {
        if (outfit("PirateRealm")) {
            s[1] = visit_url("place.php?whichplace=realm_pirate&action=pr_port");
        }
    }
    
    map_to_file(s, "test10.txt");
}

-edit- Oh, unless I already wore the eyepatch when running the script, that may have been the reason... In that case, please disregard the thread, and I guess I'll give it another go tomorrow...
 

ckb

Minion
Staff member
try this next time you want to debug:
Code:
print(visit_url("place.php?whichplace=realm_pirate&action=pr_port"));
 

Veracity

Developer
Staff member
That's actually the default if only give one parameter.

Code:
	public static Value visit_url( Interpreter interpreter, final Value string )
	{
		return RuntimeLibrary.visit_url( interpreter, string.toString(), true, false );
	}
Yesterday I had the thought that maybe he needed to send a GET - by using "false" as the second parameter - but when I tried

Code:
ash visit_url("place.php?whichplace=realm_pirate&action=pr_port")
(i.e. with POST ) in the gCLI, I got the expected HTML from KoL.
 

damion117

New member
I am trying to write a small script to farm FunPoints

Hello - I'm trying to do the same at the moment too - have you managed to track grub/grog/glue/gold in your script? I can't see an easy way of doing it (unless there's a kol page I can parse that I haven't found, or something within mafia itself).

Edit 2019/06/14:

I've managed to achieve it with the following (excuse my poor regex):
Code:
int [string] getStats()
{
    matcher pirateMatcher = create_matcher("<b>G.{3}:<\/b><\/td><td class=small>(.*?)<\/td>", visit_url("charpane.php"));

    int [string] pirateStats;

    pirateStats["guns"] = pirateMatcher.find() ? pirateMatcher.group(1).to_int() : -1;
    pirateStats["grub"] = pirateMatcher.find() ? pirateMatcher.group(1).to_int() : -1;
    pirateStats["grog"] = pirateMatcher.find() ? pirateMatcher.group(1).to_int() : -1;
    pirateStats["glue"] = pirateMatcher.find() ? pirateMatcher.group(1).to_int() : -1;
    pirateStats["gold"] = pirateMatcher.find() ? pirateMatcher.group(1).to_int() : -1;

    return pirateStats;
}
 
Last edited:
Top