Daily Deeds support

This looks really exciting, and I'd like to be able to use it to add custom Daily Deeds!

However.
I have no way of knowing what "Multi Pref" means to anyone. Same for "Boolean Pref." I know what an item is, and what a skill is, in KoL. Text, I figured out how to add by experimentation. Maybe? I guess. I mean, it will add a clump of text that I type there, but I don't see how that does any good at all.

Every time I try to set up anything other than Text, I am stopped dead by the required "preference" field. How in the world could I know what belongs there? Every time I start typing there, it just says BAD to the right of the field. I tried digits 0-9 and English alphabet a-z and A-Z. I am completely groping in the dark here. I tried typing some words and phrases that relate to the Item or Skill I want, but that doesn't work either.

Please, could we have something, somewhere, that would help those of us who are not KoLmafia developers (or those who lack the skills and knowledge to be one)? This looks really superexcitingneatokeen, but it seems I would have to know how to create or modify KoLmafia itself before I could have any hope of understanding how to add custom Daily Deeds.
 
I struggled with this as well and then started hacking around. I don't have very many answers, but I can tell you that preference refers to a preference within the <char_name>_prefs.txt file in the settings folder of KolMafia. For me this is in C:\Program Files (x86)\KolMafia\settings\

As you'll see from my previous posts, I manually added a preference called _gotSlime=10 and then dailydeeds could reference that preference. I do not currently know if it will reset daily like many of the other preferences do. Some preferences reset on ascention - again, I don't know what controls that either.

As for the text type - simply typing in text adds only little value (maybe a reminder to do something) but you can also incorporate built in mafia variables that store useful information. An example of this is the variable 'noodleSummons' which you can add to your text string and it will show you how many noodles you've summoned. Many, if not all, of these variables are in that same <char_name>_prefs.txt file. I cannot tell you if that's the ONLY place they exist though, unfortunately.

For some explanation of the custom daily deeds, hit up the wiki and search on "daily deeds". There's is some basic information, though it doesn't talk about adding them via the daily deeds preferences screen in mafia itself.

edit: oh yeah, also. in that prefs.txt file, anything thats set = to a number is considered integer type, and anything set to true or false is considered boolean type.
 
Last edited:

lostcalpolydude

Developer
Staff member
As you'll see from my previous posts, I manually added a preference called _gotSlime=10 and then dailydeeds could reference that preference. I do not currently know if it will reset daily like many of the other preferences do. Some preferences reset on ascention - again, I don't know what controls that either.
_gotSlime will be set to an empty value every day. Only preferences listed in ValhallaManager.java are reset on ascension, unless you have a postAscensionScript to specifically handle that.

Many, if not all, of these variables are in that same <char_name>_prefs.txt file. I cannot tell you if that's the ONLY place they exist though, unfortunately.
There's also GLOBAL_prefs.txt.
 

slyz

Developer
I'd like to be able to use it to add custom Daily Deeds!
Preferences -> Daily Deeds -> Help button

Just like with the Maximizer, this should tell you almost everything you need to know.

The only problem is that a rather large window will come up, and it may be larger than your screen. I think Roippi knows about it, but can't do much since it's a Java implementation problem (maybe I'm wrong though).
 

roippi

Developer
GOOD LORD. I had no idea there was a Daily Deeds section in Preferences!

If it isn't too terribly much trouble, is anyone willing to add explanations in the "Built-In Deeds" section? Just a little something in parentheses on each line? I haven't a clue what "Library Card" could possibly be, nor where (or what?) Skate Park is, for instance. I've just searched the KoL wiki and found both of them easily, and I'm guessing if I complete the Skate Park activities, then I would see something in Daily Deeds that would make my choices obvious. Still, adding a few words wouldn't be bad, would it?

I could probably add a tooltip for each. I suppose some of the names are pretty obscure, but if it's added to your deeds and it's not appearing, you probably don't need to worry about it :)

by empty value does this mean 0? or is 0 effectively the same as NULL in this case?

Unfortunately empty means an empty string (which is not NULL, but you can think of it like that). This will cause your custom deed to stop working the next day, since the preference you created no longer exists. The way I get around this is to set a preference, and reset that preference to false with a login script if breakfastCompleted = false. It's a bit hacky, but it works. ETA: is there a better way of doing this? While this works for me, it feels kludgey and fragile.

re: help button

Yeah, I know it's big and clunky. I think I want to update the wiki and just have the help text link you there.

However.

<stuff>

I understand your frustration. I would like things to be better documented. The help text and the wiki are good starts, I think, and the latter will improve over time.

However, this is a feature intended for advanced users - in order to make it flexible, I have to include some things that are going to be technical hurdles for some users. But hey, that's what this thread is for.
 
Last edited:

Veracity

Developer
Staff member
re: help button

Yeah, I know it's big and clunky. I think I want to update the wiki and just have the help text link you there.
How about putting the text into a scrollable field?

You call JOptionPane.Showmessagedialog( new JPanel(), message, "Custom Deeds Help", JOptionPane.PLAIN_MESSAGE ); where "message" is a String. That method accepts an "Object". What if you constructed - perhaps even statically - a scrollable text field?

In any case, I do think that the help text doesn't need to be constructed at runtime every time you click the Help button. Make it static. It doesn't change.
 

roippi

Developer
How about putting the text into a scrollable field?

You call JOptionPane.Showmessagedialog( new JPanel(), message, "Custom Deeds Help", JOptionPane.PLAIN_MESSAGE ); where "message" is a String. That method accepts an "Object". What if you constructed - perhaps even statically - a scrollable text field?

In any case, I do think that the help text doesn't need to be constructed at runtime every time you click the Help button. Make it static. It doesn't change.

Funny story, I actually already made a patch to do this. It works. The problem is that.. I still don't like it. JOptionPane.ShowMessageDialog is the demands-focus-until-you-close-the-window type of message box. So is the custom deed builder. I think as a user I'd prefer to have both open at the same time so I can reference one while working on the other.

You're right about the static bit.

I'll guess I'll commit the scrollpane, because it's strictly better than the current implementation.
 

lostcalpolydude

Developer
Staff member
I've wanted to use prefref while creating a custom deed, so the forced focus generally means closing the custom deed window and reopening it when I'm ready again.
 
So - now I'm trying to figure out how to implement a button to get me vials of slime. Up to 10 can be retrieved/day but obviously only if you're a sauceror and the nemesis quest is completed. I assume the only way to do this would be via MultiPref, but does a preference exist that can be utilized?

edit: ok i created this, and i'm thinking it will work, but i already got my slime for today so i'll have to wait for tomorrow. searching the forums i found that the "volcano slime" command is built in and gets 1 slime at a time, so hopefully setting this up as a 10/day usage will do what i'm hoping. so i guess my question then is will the preference automatically get reset daily or does it have to be built into mafia for that to happen?

$CUSTOM|MultiPref|Get Slime|_gotSlime|volcano slime|10

ok, it's the next day and it's working sort of. the get slime button invokes "volcano slime" and gets me one, but the counter is not incrementing. it just stays at 0/10 even though i'm getting them.
 
Last edited:

Winterbay

Active member
I guess you could do "ash visit_url("volcanoisland.php?pwd&action=npc&subaction=getslime");". There is a command but I can't find it atm (not even after going through all the commands listed by "help")...

Edit: The volcano-command is for solving the volcano maze.
 

Winterbay

Active member
"volcano slime" calls Mafia's VolcanoIslandRequest.getSlime(), which visits volcanoisland.php?pwd&action=npc&subaction=getslime.

Oh? "help volcano" does not show "slime" as a valid argument for the volcano command.
 
when i do "get _gotSlime" it returns 0 and i can see it in the prefs file, so basically clicking the button doesn't increment it, even though the command itself is working.
 
Last edited:

Veracity

Developer
Staff member
when i do "get _gotSlime" it returns 0 and i can see it in the prefs file.
Although we do have a "volcano slime" command (and yes, somebody should add one word to the command's help string...), we do not detect and track daily calls to that URL; that preference is not built-in to KoLmafia. If it were, you would see it incrementing because KoLmafia increments it. It'd be easy enough to build in to VolcanoIslandRequest; since it takes a turn (right?), we should show the turn usage in registerRequest and increment the counter if successful in parseResponse.

Aren't Custom Daily Deeds supposed to be able to manage their own counters? If so, I'd expect it to increment the counter - although I'm not sure how it can distinguish between a counter that is already managed by KoLmafia but with no built-in Deed to display it and one which is purely a user's counter.
 

roippi

Developer
Aren't Custom Daily Deeds supposed to be able to manage their own counters? If so, I'd expect it to increment the counter - although I'm not sure how it can distinguish between a counter that is already managed by KoLmafia but with no built-in Deed to display it and one which is purely a user's counter.

Indeed. There is no way to tell. Well, I suppose you could check if the preference exists in defaults.txt

If a user is creating a preference and expects it to track a daily activity, they should make it track said daily activity (using ASH or an alias). The intent is not to provide a counter that just tracks the number of times that you've clicked the button, but a counter that meaningfully reflects the state of the character.

I could be convinced to automatically increment the preference on click, for user-created preferences. But then you've got two types of behavior and that could get confusing fast.
 
Top