Neo's Semirare Farming Script

flypapermonk

New member
Neo's Semirare Farmer 1.1.1

This semirare counter script goes a tiny bit farther than the typical cookie script. The others only check a handful of semirares in the mall, but this one is designed to check the mall for each and every semirare available to you for what will net you the most meat before retrieving it. However, it does support having a preference on which semirare you prefer and will get that one every chance it gets. I've tried to make it as robust as possible, but please let me know of any problems or feature requests!

It is also designed to be very easily imported into your normal counter checker script to quickly and simply add semirare farming.

Currently does not support:
- Semirares like the KGE outfit that have multiple, different item drops in them

To install this script, simply put it in your scripts directory and type:
set counterScript = FarmSemiRare.ash
into the cli.

This script requires zlib.

Updates:
1.0.1
- fixed a bug based on unexpected mafia interpreter strangeness
- made the script a lot more verbose
1.0.2
- renamed an accidentally overloaded function for clarity
1.0.3
- added the ability to import into other scripts and call it from there
1.0.4
- the code to actually go get the semirare was commented out, fixed
1.1.0
- added support for hobopolis semirares (you'll need new semirare.txt) (BETA! I don't have hobopolis access so checking to see if you have access to the zones might not work)
- removed reliance on canadv because it is not being maintained
- added check to make sure there are, in fact, viable semirares to get
- now properly checks price on semirares of which you get more than one(example: massage oil)
1.1.1
- fixed a bug that kept the script from working
 

Attachments

  • semirares.txt
    1.5 KB · Views: 201
  • FarmSemiRare.ash
    28.3 KB · Views: 161
Last edited:

Spiny

Member
This semirare counter script goes a little farther than the typical cookie script. Unlike the others, this one is designed with meat gain in mind and checks the mall for each semirare available to you for what will net you the most meat before retrieving it. However, it does support having a preference on which semirare you prefer and will get that one every chance it gets.

Umm... I thought Bale's Counterchecker does handle this? I haven't actually used it, but the impression I get from the below is that it does :)

Fortune Cookie: If you're not in hardcore it will get the available semi-rare with highest mall price.

It's cool that multiple scripts exist for similar purposes, but to state "unlike the others" in your introduction seems a bit off to me.

And I'm amused by this comment in your code ;) :

Code:
      # blatantly copied code from bale because I don't understand it yet
 

flypapermonk

New member
Eh, fair enough. When I was looking through CounterChecker I didn't see any obvious functionality for checking mall prices, but I have been known to be lazy from time to time. I do believe, however, that mine does check close to all of the semirares rather than the few currently considered to be valuable (probably not going to change but I'm a bit of a perfectionist). This was, however, intended to be used as part of my other farming script but I figured people might want to have it standalone as well, so here it is!
 

flypapermonk

New member
Ack, apparently this script does not work. Anyone out there care to help me figure this out? I keep comparing it to a script I know does work and I can't find any major differences that would be causing it. I was doing my normal adventuring (via another script) and the counter expired so this script was called and it simply said in the cli, "Fortune Cookie counter expired." and stopped all my scripts.
 

Bale

Minion
Bale's Counterchecker does indeed check mall prices to figure out which semi-rare is most expensive. (Plus it handles dance cards, absinthe farming and more.) I'll admit that I don't bother checking the cheap-o ones like the poltergeist in a jar since it just seemed like a waste of run time.

I was doing my normal adventuring (via another script) and the counter expired so this script was called and it simply said in the cli, "Fortune Cookie counter expired." and stopped all my scripts.
Were you doing something that uses more than 1 adventure at a time, like the sea or cooking without a chef? I notice your script does not give any useful feedback if that happens.
 

flypapermonk

New member
Ah! Here we go, I found the problem: mafia's script interpreter. Seems you can't call a function inline with a return command. Changed
Code:
return get_fortune_cookie();
to
Code:
boolean ret = get_fortune_cookie();
return ret;
 
Last edited:

Veracity

Developer
Staff member
Ah! Here we go, I found the problem: mafia's script interpreter. Seems you can't call a function inline with a return command.
Huh? If you think there is a bug in KoLmafia, come up with a test case demonstrating it and file a bug report.

Code:
return get_fortune_cookie;
You do realize that this is not calling a function?
 

flypapermonk

New member
You do realize that this is not calling a function?

Sorry, it was an early morning typo. Fixed it, and double checked in mafia just in case I was indeed being retarded. Calling "return get_semirare();" does not in fact call the function before the return statement. Actually, this is the second "bug" I've found alongside with a function that didn't quite work how I expected it to. I'm still kinda new to all this, so pardon my ignorance, but how do I submit an official bug report for KoLmafia?

note: I am using daily build 7624

edit: Oddly enough, I am trying to replicate the behavior in a fresh, simpler script and it isn't breaking like it does in my semirare script.
edit: Here we go!
Code:
boolean diditwork()
{
   int something;

   print("It worked!");
   return true;
}


boolean main(string name, int remain)
{
   return diditwork();
}
This will not make it to the print command. However, if you comment out the integer declaration in the function it will. Curiouser and curiouser.
 
Last edited:

Grotfang

Developer
I'm not sure I fully understand the problem here. Try this:

Code:
boolean diditwork(int something)
{
	print("Something = " + something);
}


boolean main(int something)
{
	return diditwork(something);
}

This returns as expected for me. What is it you are wanting to do, and what is it that is returning weirdly?

Also, what was the point in creating an integer that has no value? I believe it is that that is stopping your initial script. Give it a value and it should work fine.
 
Last edited:

flypapermonk

New member
Also, what was the point in creating an integer that has no value? I believe it is that that is stopping your initial script. Give it a value and it should work fine.

It was more of an example than anything else. And you are totally right, if I assign a value to that integer in the example the code works.

The actual problem is that in my real code I have (paraphrased and snipped for space purposes):
Code:
boolean get_semirare()
{
   SemirareInfo [int] semis;

   if (!file_to_map(SEMIRARE_DATA_FILE, semis))
   {

.........

boolean main()
{
   return get_semirare();
}
This is not going to work properly, and so I have to write the little workaround of capturing the return value from the function and then calling return in main.
 

Veracity

Developer
Staff member
Very interesting. I have a fix for the return statement which I will submit, by and by. Thanks!
 
Hey, wouldn't the historical pricing be better for this? I can appreciate the completeness of checking the value of every one, but I'm not sure we need to do that every time.

That said, you know what feature the cookie script really needs? I love Bale's CounterScript (thanks), but when I'm in ronin, I always forget, and the counter grabs the wrong one. At least i eat well off the lunchboxen ;-). We should be able to have it work a configurable list of semirares you want to get in ronin (KGE, eyedrops, ascii, inhaler). That would rock my socks.
 

mredge73

Member
yea,
I had planned on making an edit to Bale's script to make it work with HC but I have yet to get to it.

The semi-rares that I get in HC are as follows:
1 Lunch Box -- I usually get a semi-rare before being able to open the knob
2 Goblin Elite Outfit --for access to the lab store
3 Scented Massage oil -- for spookraven or NS
4 LunchBox
5 Scented Oil
6 Ascii -- makes the orc chasm go by much faster due to the scrolls that it drops
7 inhaler -- for nuns
8 eyedrops
9 inhaler -- for nuns, getting 2 before the quest is awesome if you can do it
etc.. etc..

I would be curious about what order or what items others get doing HC or Ronin before taking on this task.
 

flypapermonk

New member
That said, you know what feature the cookie script really needs? I love Bale's CounterScript (thanks), but when I'm in ronin, I always forget, and the counter grabs the wrong one. At least i eat well off the lunchboxen ;-). We should be able to have it work a configurable list of semirares you want to get in ronin (KGE, eyedrops, ascii, inhaler). That would rock my socks.

I had some good ideas for how to do this today so I might start working on this soon. Any requests on how this sort of thing would work best for you?

Side note to veracity: you never really answered my question on how to submit official bug reports for KoLmafia. I have one more bug to report as well as a "Was that -really- how it was supposed to work?" question about one of the functions.
 

Veracity

Developer
Staff member
Side note to veracity: you never really answered my question on how to submit official bug reports for KoLmafia. I have one more bug to report as well as a "Was that -really- how it was supposed to work?" question about one of the functions.

Umm. Well, if you go to the main index page of kolmafia.us and move your eyes up to the top forum group labeled "Important", and look at the third one down, you'll notice that it is named "KoLmafia Bug Tracker".

I suggest you take a look in there.
 
I had some good ideas for how to do this today so I might start working on this soon. Any requests on how this sort of thing would work best for you?

To me, the easiest way to work a list would be to write the list "in order of preference", and let mafia figure out it's "availability" (canadv()?), then the script just takes the "first available" one in the list, popping it from the queue so it's not taken again. If there's nothing left in the queue/list, cookiescript would revert to it's normal mall pricing functions. But i'm not a scripter. I only play one in the privacy of my own home.
 

flypapermonk

New member
To me, the easiest way to work a list would be to write the list "in order of preference", and let mafia figure out it's "availability" (canadv()?), then the script just takes the "first available" one in the list, popping it from the queue so it's not taken again. If there's nothing left in the queue/list, cookiescript would revert to it's normal mall pricing functions. But i'm not a scripter. I only play one in the privacy of my own home.

Ack, that's not exactly what I meant.... what I was looking for from you is what you want the script to do, the behavior you want to happen. I'll figure out how to make it happen, don't worry about that part.
 

flypapermonk

New member
Update!

Script has been updated to 1.1.0!

Changes:
- added support for hobopolis semirares (you'll need new semirare.txt) (BETA! I don't have hobopolis access so checking to see if you have access to the zones might not work)
- removed reliance on canadv because it is not being maintained
- added check to make sure there are, in fact, viable semirares to get
- now properly checks price on semirares of which you get more than one (example: massage oil)
 

jwylot

Member
Error in semirare.ash

Hiya,

I've been happily using this script for a couple of months but since updating to the latest version of zlib and mafia I keep getting the following error:
Function 'error( string )' undefined (FarmSemiRare.ash, line 38)
Fortune Cookie counter expired.

I'm a total dumbass when it comes to anything remotely technical and would be very glad if someone could point me in the right direction.

Thanks.

Joe
 

lostcalpolydude

Developer
Staff member
Hiya,

I've been happily using this script for a couple of months but since updating to the latest version of zlib and mafia I keep getting the following error:


I'm a total dumbass when it comes to anything remotely technical and would be very glad if someone could point me in the right direction.

Thanks.

Joe

I believe doing a find-replace changing "error(" to "vprint(" will solve the problem. Zarqon removed error() from zlib.
 
Top