Semirare Advisor - Proof of concept

Metraxis

Member
This is a script which serves two purposes. First, for those zones coded into its data file (only a handful at the moment), it should be able to determine to which areas you have access, and, taking into account the last semirare you picked up, select the most expensive semirare available. It also is intended as a way to test a method for determining to which areas you have access, with a relative minimum of server hits (each container page should only get get once).

Known issues:
-Some areas move over the course of an ascension, (Outskirts of the knob and Haunted Pantry do this) but I see this as more of an aftercore thing and both of those areas are always available anyway, so I am not sure its a big deal.

-I haven't yet tested the way that loading containers you don't have access to works. If it's an issue, it'd be an issue primarily in the Pirate Cove, but if memory serves, there are no semirares in the Barrr/ship map anyway.

-It's been a long time since I've written any new ash scripts, and I've forgotten a number of things, like how to use historical prices.

Opinions and suggestions welcome.

Since the example data file (Map.SemiRare.map) doesn't have an approved extension, the contents are as follows:
Code:
Burnbarrel Blvd.	place=4	clan_hobopolis.php?place=2	jar of squeeze	1
Exposure Esplanade	place=5	clan_hobopolis.php?place=2	bowl of fishysoisse	1
Haunted Pantry	snarfblat=113	manor.php	tasty tart	3
Outskirts of The Knob	snarfblat=114	knob.php	Knob Goblin lunchbox	1
Sleazy Back Alley	snarfblat=112	town_wrong.php	distilled fortified wine	3
 

Attachments

  • Script.Semirare.Adder.ash
    1.8 KB · Views: 63
  • Script.Semirare.ash
    1.3 KB · Views: 70

slyz

Developer
Known issues:
-Some areas move over the course of an ascension, (Outskirts of the knob and Haunted Pantry do this) but I see this as more of an aftercore thing and both of those areas are always available anyway, so I am not sure its a big deal.
The locations move on the map, but I don't think there URL changes, so you should be fine.
 

Theraze

Active member
As well, an easy way to upload the data file would be to put a .txt on the end, which actually makes it more complient with the 'standard' format found in the data folder.

Somewhat of a different naming convention throughout with the Script.<name>, but... can always be fixed locally. :D
 

Metraxis

Member
The locations move on the map, but I don't think there URL changes, so you should be fine.

True, the adventure location doesn't change, but the identity of the container page does. I think you're right about it not being a big deal, though.

As well, an easy way to upload the data file would be to put a .txt on the end, which actually makes it more complient with the 'standard' format found in the data folder.

Somewhat of a different naming convention throughout with the Script.<name>, but... can always be fixed locally. :D

The naming convention is a holdover from a time when I tried to organize the large selection of includables I've built for another project into directories and it just didn't work.
 
Last edited:

slyz

Developer
I looked at the script - I understand why you were concerned now, you use the container to check if the location is available. I don't think people will use this without the manor or the cobb opened, but if you want to account for those edge cases, you could always add a secondary container in the data.
 

Theraze

Active member
I believe if you try to check a container that doesn't exist, the whole script aborts... So you'd just need to check through in order. If Cobb's Knob isn't unlocked, you can't check if the lab is unlocked, etc. Basically what slyz just said, except with the "script dies" caveat added. :)
 

Bale

Minion
I believe if you try to check a container that doesn't exist, the whole script aborts...
Quite true.

So you'd just need to check through in order. If Cobb's Knob isn't unlocked, you can't check if the lab is unlocked, etc.
And that's why you need to look for the knob lab key. :)

Though generally quite true. First you need to see if the container is there before you can look into the container.
 

Theraze

Active member
Just saying that's a problem I had with the CanAdv script myself... it would assume that if you were level 5, you could get into the treasury/harem/kitchen. When I made it actually check for the link in there, it would abort if the zone wasn't unlocked. I had to tweak the check to search for the zone being unlocked before checking in the harem... ended up using this:
if (!levelcheck(5) || contains_text(visit_url("plains.php"), "knob1.gif")) return false; return (perm_urlcheck("knob.php",to_url(where)));
 

Metraxis

Member
I believe if you try to check a container that doesn't exist, the whole script aborts... So you'd just need to check through in order. If Cobb's Knob isn't unlocked, you can't check if the lab is unlocked, etc. Basically what slyz just said, except with the "script dies" caveat added. :)

I'm not quite sure what you mean by checking a container that doesn't exist. Can you give an example?

On a related note, is persistent data handling in mafia robust enough to handle the write-out of a map of a record type which contains a map of a record type?

I've added a couple more areas and renamed the datafile, so it should be easier to use/try to break.
 

Attachments

  • Script.Semirare.Adder.ash
    1.8 KB · Views: 60
  • Map.SemiRare.txt
    467 bytes · Views: 62
  • Script.Semirare.ash
    1.3 KB · Views: 58

Theraze

Active member
Two examples for you:
If you try to check any of the locations in knob.php before unlocking the Knob, the script would abort.
If you try to check if the Haunted Bathroom is available upstairs, instead of checking if the stairs are there in the main floor... abort.
 

Metraxis

Member
Two examples for you:
If you try to check any of the locations in knob.php before unlocking the Knob, the script would abort.
If you try to check if the Haunted Bathroom is available upstairs, instead of checking if the stairs are there in the main floor... abort.

I see. I'll have a look at those when I ascend again.
 

Theraze

Active member
As a test, you could try out this for yourself... after you unlock the knob:
> ash (contains_text(visit_url("knob.php"),to_url($location[knob goblin harem])))

Returned: true
Before:
> ash (contains_text(visit_url("knob.php"),to_url($location[knob goblin harem])))

Server www7.kingdomofloathing.com returned a blank page from knob.php. Complain to Jick, not us.

Anytime you try to visit a page in a zone that isn't unlocked yet, you'll get that type of blank page error...
 
Top