turbo_room,123,111,3 script Voucher A Manager 4_M_OPERATION,{
/*-----------------------------------------------------
Script
-----------------------------------------------------*/
"Would you exchange your "+ .pod_name$ +" "+
"for "+ .points_name$ +"?";
mes "Exchange Rate: "+ .
rate +":1";
mes .
points_name$
+": [^FF0000"+ getd(.
points_var$
) +"^000000]";
case 1:
mes "Okay, come back if you change your mind!";
case 2:
mes "Please enter the amount of "+ .
pod_name$
+" you want to exchange.";
do {
mes "Input ^0000FF0^000000 to cancel.";
.@total = .@amount / .rate;
.@remainder = .@amount % .rate;
// Check break input
if (!.@amount) {
}
// Check total against inventory
mes "^FF0000Please enter a valid amount.^000000";
}
// Check remainder [loss prevention]
else if (.@remainder) {
mes "Sorry, but you must exchange multiples of "+ .
rate +".";
}
} while (countitem(.
pod_id) < .@amount || .@remainder
);
setd .
points_var$,
getd(.
points_var$
) + .@total;
mes "You've exchanged "+ .@amount
+" "+ .
pod_name$
+" for "+ .@total
+" "+ .
points_name$
+". "+
"You now have "+ getd(.
points_var$
) +" "+ .
points_name$
+" and "+ countitem(.
pod_id) +" "+ .
pod_name$
+".";
case 3:
mes "Please enter the amount of "+ .
points_name$
+" that you want to exchange.";
do {
mes "Input ^0000FF0^000000 to cancel.";
.@total = .@amount * .rate;
// Check break input
if (!.@amount) {
}
// Check amount against points
if (getd(.
points_var$
) < .@amount
) {
mes "^FF0000Please enter a valid amount.^000000";
}
} while (getd(.
points_var$
) < .@amount
);
// Check weight
mes "^FF0000You're overweight; please store some items.^000000";
}
setd .
points_var$,
getd(.
points_var$
) - .@amount;
mes "You've exchanged "+ .@amount
+" "+ .
points_name$
+" for "+ .@total
+" "+ .
pod_name$
+". "+
"You now have "+ getd(.
points_var$
) +" "+ .
points_name$
+" and "+ countitem(.
pod_id) +" "+ .
pod_name$
+".";
}
/*-----------------------------------------------------
Configuration
-----------------------------------------------------*/
OnInit:
.npc_name$ = "[^0000FFVoucher Manager^000000]";
.rate = 10; // Exchange rate (1 point * rate = total PoDs)
.pod_id = 7615; // Proof of Donation item ID or constant
.
pod_name$
= getitemname(.
pod_id) +"(s)";
// Proof of Donation item name
.points_name$ = "Cash Point(s)"; // Points name
.points_var$ = "#CASHPOINTS"; // Points variable
// Modifying these options requires updates to the corresponding case
setarray .
menu_options$
[0],
"^FF0000>^000000 Cancel",
"^0000FF>^000000 Exchange "+ .pod_name$ +" for "+ .points_name$,
"^0000FF>^000000 Exchange "+ .points_name$ +" for "+ .pod_name$;
}