alohadoubt 0 Posted August 25, 2014 are this commands #CASHPOINTS and #KAFRAPOINTS can be use in NPC script? can someone give me a sample. Quote Share this post Link to post Share on other sites
0 Gerz 7 Posted August 26, 2014 if( #CASHPOINTS < 999 ) {mes "Not enough cash points";close;}#CASHPOINTS = #CASHPOINTS - 999;close; Quote Share this post Link to post Share on other sites
0 alohadoubt 0 Posted August 26, 2014 I see. thanks that same with kafrapoints? right Quote Share this post Link to post Share on other sites
0 alohadoubt 0 Posted August 28, 2014 (edited) input @ticket; if(countitem(30801)<@ticket) { cutin "kafra_06.bmp",255; mes .@adikrepname$; mes "Insufficient A.D. tickets. Please come back when you have enough tickets."; close; } delitem 30801,@ticket; set #CASHPOINTS, #CASHPOINTS+(@adtpoints*@ticket); cutin "kafra_06.bmp",255; mes .@adikrepname$; mes "Cash Points Added."; close; let say if the user input -1 or just 0 or letter how do I add additional check on user input? Edited August 28, 2014 by alohadoubt Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted August 29, 2014 You can cap a variable under certain limits. Check input script command at https://github.com/HerculesWS/Hercules/blob/master/doc/script_commands.txt#L1560 *input(<variable>{,<min>{,<max>}}) Or, if you don't trust the auto capping, you can reiterate it until you get a number you want from the user by using a do...while: do { mes "Please, insert a number between 0 and 100!!"; input .@number;} while (.@number < 0 || .@number > 100); Hope this helps. P.S.: I don't know what happens if you expect a number but enter a string or a single character, but I think it gets converted to the decimal ASCII value of the number or so. Quote Share this post Link to post Share on other sites
0 alohadoubt 0 Posted August 29, 2014 (edited) perfect this seems to work do { input @ticket; } while (@ticket < 1 || @ticket > 1000); if(countitem(30801)<@ticket) { cutin "kafra_06.bmp",255; mes .@adikrepname$; mes "Insufficient A.D. tickets. Please come back when you have enough tickets."; close; } delitem 30801,@ticket; set #CASHPOINTS, #CASHPOINTS+(@adtpoints*@ticket); cutin "kafra_06.bmp",255; mes .@adikrepname$; mes "Cash Points Added."; close; thanks Edited August 29, 2014 by alohadoubt Quote Share this post Link to post Share on other sites
0 Dastgir 1246 Posted August 29, 2014 You can do like this too, do { next; mes "Insert The Amount";} while (input(@ticket,1,100)!=0); Quote Share this post Link to post Share on other sites
are this commands #CASHPOINTS and #KAFRAPOINTS can be use in NPC script? can someone give me a sample.
Share this post
Link to post
Share on other sites