Custom deeds

Nappa

Member
I was fiddling around with buying raffle tickets using a customized daily deed option. Usually I buy 10 raffle tickets each day, so I set up a button that buys 10 raffle tickets, with a max usage of 1. But suppose I were to feel like a punk and lucky, and want to purchase some more, how can you set this up? Of course I can set a higher max usage value and it will track how many times i've bought 10 tickets. But is it also possible to configure it without a maximum, while it still displays how many tickets you've bought?

On a related note, what is the meaning of the 'preference' value that is required for non-simple custom deeds? Is the dailyDeedOptions documented somewhere?
 

roippi

Developer
You may want to read more about preferences here and more about daily deeds here.

To get what you're wanting, you would need two separate deeds, a command deed and a text deed.
 

Nappa

Member
Ah, thanks for the info. Don't see how I missed that.

Anyway, am I correct in assuming it's not possible to leave out a maxUses? Omitting it seems to add a cap of 1. If that's the case, there doesn't seem to be a point to add a custom preference counter, since if you don't add a cap, the button is disabled after 1 click, and if you add a cap, a usage counter is already added automatically.

To illustrate:
$CUSTOM|Command|Buy 10 raffle tickets|_rafflesBought|raffle 10
$CUSTOM|Text|Bought tickets |_rafflesBought| times
vs:
$CUSTOM|Command|Buy 10 raffle tickets|_rafflesBought|raffle 10|100

Or can I somehow incorporate something like "|item_amount raffle ticket|" into the text command?
 

roippi

Developer
One issue is that _rafflesBought isn't an actual mafia preference, so the command you use in the command deed has to handle updating it. Otherwise it's always going to show 0. That's the difference between simple and command deeds: simple deeds automatically create a preference for you and increments it on button click. Command deeds leave it up to you to know whether it's a built-in preference or not, and update it yourself if it's not.

Other than that, you can feel free to specify a maxUses if you're okay with having a limit on there. If you wanted it actually completely 100% unlimited, you would need to do the first thing you mentioned: command deed on one line, text deed on another.
 
Top