SmartStasis -- a complex script for a simple CCS

zarqon

Well-known member
Evil GGG Update

I've been thinking and thinking about how to make this work, and I finally have a solution, which I will put in the next update. I just need to somehow get the name of your ghost. If charpane.php is accessible during combat, then problem solved. Otherwise, it will involve user input and a character setting, and will be breakable if you rename your ghost. This is not a foolproof solution (especially if your ghost is named something like "damage" or "Combat"), but it's the best I can do.

@psyl4mne: As far as I know, any gremlin (other than an A.M.C.) may drop a tool until their i-don't-has-tool attack message shows up, so they are stasis'd until they drop a tool or let you know they can't. If this is a wrong assumption, I would be happy to hear why.

@tebee: Glad you got it figured out.
 
Last edited:

StormCrow42

Member
@psyl4mne: As far as I know, any gremlin (other than an A.M.C.) may drop a tool until their i-don't-has-tool attack message shows up, so they are stasis'd until they drop a tool or let you know they can't. If this is a wrong assumption, I would be happy to hear why.

Each gremlin has a specific tool that it drops. Yossarian tells you both which tool to look for and where to find it. So in the zone you adventure in, you'll find several different gremlins, an AMC gremlin, the gremlin that has the tool, his clone that doesn't have the tool, and other gremlins who also won't have the tool you're looking for here. The variable "currentJunkyardTool" contains which tool you're looking for (and by extension, which gremlin has it).
 

zarqon

Well-known member
So, to clarify: ONLY the tool Yossarian has mentioned will drop, ever? Will the right gremlin drop a tool in the wrong area? If this can be confirmed, I'll change the gremlin detection logic.

My session logs did not help me figure anything out... the last handful of times I've finished this sidequest in under 7 adventures.
 

StormCrow42

Member
So, to clarify: ONLY the tool Yossarian has mentioned will drop, ever? Will the right gremlin drop a tool in the wrong area? If this can be confirmed, I'll change the gremlin detection logic.

My session logs did not help me figure anything out... the last handful of times I've finished this sidequest in under 7 adventures.

From what I've gathered, both from the wiki and from my personal observations when I've done the quest by hand, the tools only drop in the locations that Yossarian tells you. OTOH, I'm not absolutely positive that you have to visit him before they start dropping tools. I haven't tested the case of adventuring in all 4 areas looking for tools without talking to him first (or in between). I have one account coming up on the quest tomorrow, perhaps I'll try to spade that then.
 

StormCrow42

Member
Ok, I've tested the case of not visiting Yossarian between visits to various areas. Mafia clears currentJunkyardTool after you find one, but when I reset it to a nonsense value so that SmartStasis would still stasis gremlins, I found the other 3 tools without going back to visit Yossarian. So currentJunkyardTool isn't the only tool that will drop (although it is probably the only tool that will drop in currentJunkyardLocation). I'm not certain that it's worth writing the logic of avoiding stasising the wrong gremlin only in currentJunkyardLocation.
 

zarqon

Well-known member
@StormCrow: Thanks for the spading. In light of your data, it would appear that the current gremlin-stasising algorithm does not require changing. At least, not just yet -- the next question is, can more than one tool drop at once, or is only one tool ever available at any given time?

I was holding off on releasing the next update to see if I needed to redo the gremlin logic. Since we're still not sure, I've released 1.6.

1.6 Update: Now works with GGG's. Finally.

IMPORTANT! The detection algorithm for GGG's uses the name of your ghost. If the ghost's name does not appear in the page text, it means your ghost didn't act and is therefore out of charges. And to get your ghost's name, the script has to hit charpane.php every combat. This is sub-ideal, so I've also written a workaround into the script. If you set the name of your ghost (there's a variable named ghostname at the top of the script), then the script will use that as your ghost's name and will not bother with the extra server hit.

I highly recommend if you intend to use this script with a GGG that you
1) Set your ghost's name in the script.
2) Don't name your ghost something like "damage", or other text that may appear in combat.
 

Bale

Minion
Not sure what you mean by "can more than one tool drop at once". Each zone is only capable of dropping a specific tool from a specific type of gremlin. No matter how many times you adventure over by that rusted out car, there is only a single specific tool that can be found there, regardless of whether Yossarian has told you what it is.

If that isn't what you were asking... well... dunno.
 

StormCrow42

Member
I think that the optimum solution to gremlin stasising would be:

  1. If we're adventuring in currentJunkyardLocation, stasis only the gremlin that drops currentJunkyardTool
  2. If we're adventuring elsewhere in the junkyard AND we have the magnet, stasis everything but the AMC gremlin
  3. If we don't have the magnet, don't stasis gremlins ever

Case 1 is going to be the most common case (visiting Yossarian after every tool drop, like OCW does), but case 2 might be interesting for someone who doesn't bother to go back to Yossarian for whatever reason.
 

zarqon

Well-known member
Bale -- that pretty much answers my question, yes. I wanted to know if multiple tools were available after Yossarian told you to get Tool X, or if only Tool X was available. In other words, are the tools available in some sort of random-per-ascension sequence, or are they all available depending on zone? According to your information, tool availablility is tied only to zone, not to sequence, so all tools are available upon beginning the quest, one per zone.

Which means StormCrow's recommended behavior is basically right on -- although if currentJunkyardLocation and currentJunkyardTool are known and we are in one of the other locations, we don't need to stasis the gremlin that drops currentJunkyardTool.

I'll add this in to the next update.
 

dj_d

Member
Found a painful bug. Wossname fought GMOB, won, but couldn't compete the quest! If you check out the wiki entry for GMOB, you'll see that if you use ambidextrous funkslinging, the order of mirror/flyers matters. I think SS got the order backwards and killed him before it flyered him (this was my first ascension with ambi-funk).
 

StormCrow42

Member
Found a painful bug. Wossname fought GMOB, won, but couldn't compete the quest! If you check out the wiki entry for GMOB, you'll see that if you use ambidextrous funkslinging, the order of mirror/flyers matters. I think SS got the order backwards and killed him before it flyered him (this was my first ascension with ambi-funk).

Were you using at least version 2.4 of FTF? The order was changed in that version.
 

zarqon

Well-known member
I don't do version-checking in CCS's, because that would be a ridiculous amount of server hits. But, unlike my other scripts that have version-checking, I make sure to post update posts in the related threads, so that anyone who is subscribed to the thread will immediately be aware of new updates.
 

jasonharper

Developer
I don't do version-checking in CCS's, because that would be a ridiculous amount of server hits.
So, do your version check if a preference named something like "_FTFVersionChecked" is false, then set it to true. Prefs starting with an underscore now get cleared every day.
 

Bale

Minion
So, do your version check if a preference named something like "_FTFVersionChecked" is false, then set it to true. Prefs starting with an underscore now get cleared every day.
I cannot begin to enumerate all the wonderful ways that feature might be used... Finally a foolproof and VERY simple way to check that you've done something once every day.
 

mredge73

Member
can someone explain this new idea/concept?
so there is a way to not check the version everyday?
my scripts (not released yet) do a version check every time I call them, how would I fix that.
 

Bale

Minion
can someone explain this new idea/concept?
so there is a way to not check the version everyday?
my scripts (not released yet) do a version check every time I call them, how would I fix that.

The basic concept is this;
Code:
if(get_property("_checkedToday") == "") {
	check_version();
	set_property("_checkedToday" = "true");
}
Every single day, the first time mafia logs on it will set _checkedToday to an empty string. If it is "", then you know you haven't checked yet.
 

jasonharper

Developer
if(get_property("_checkedToday") == "")
Except, of course, that "_checkedToday" is a horrible choice for the name - there is only one namespace for preferences, shared by ALL scripts and KoLmafia itself, so user-created ones need to take some care to avoid duplication. Including your name, or the script's name, would be a good idea.
 

mredge73

Member
thanks, with a little syntax correction it worked perfectly
Code:
if(get_property("_"+file) != "true")
	{
		set_property("_"+file , "true");
                CheckVersion();
        }

another question
Is there a secret list somewhere of these properties?
I know that it won't have user created properties on it but it would help to know what properties mafia uses.
 

StormCrow42

Member
another question
Is there a secret list somewhere of these properties?
I know that it won't have user created properties on it but it would help to know what properties mafia uses.

Simply go do your settings subfolder and open one of the prefs files.
 
Top