Of course, if all you want is a CLI script, you don't need cli_execute. Call it raffle1.txt, say, and just put in:
raffle 1 storage
boolean daily_raffle() {
boolean result
switch ( ! to_boolean(get_property("_raflled_" + my_name() ) )
{
case (true):
result = true;
break;
default:
result = cli_execute("raffle 1 inventory") ;
set_property("_raffled_" + my_name() , result);
}
return result;
}
// code from above
main() {
if( daily_raffle() )
{
print("You've bought your ticket for the day." , "blue");
} else {
print("You were unable to buy your ticket today." , "red");
}
}
# amount of tickets you want, edit to change:
int num_tickets = 10;
boolean daily_raffle( int num ) {
if ( item_amount($item[raffle ticket]) < num )
return cli_execute("raffle "+(num-item_amount($item[raffle ticket]))+" inventory");
return true;
}
void main () {
if( daily_raffle(num_tickets) )
print("You've bought your ticket(s) for the day." , "blue");
else
print("You were unable to buy your ticket(s) today." , "red");
}
if(available_amount($item[raffle ticket]) < 1) {
if(can_interact() {
cli_execute("raffle 1 inventory");
} else cli_execute("raffle 1 storage");
}
EDIT: I finally remembered to look up what tags do colored snippets!
if (item_amount($item[raffle ticket]) < 1)
cli_execute( "raffle 1" );