Leander Tyles Posted May 18, 2013 Share Posted May 18, 2013 integer getRefund(integer expiration){ return (((expiration - llGetUnixTime()) / 86400) * RENT_RATE / 7); }this little code determines / returns... how much to refund a person based on thier rental time left,but i also want to deduct a 20% fee can sombody help Link to comment Share on other sites More sharing options...
Ela Talaj Posted May 18, 2013 Share Posted May 18, 2013 Try this: integer getRefund(integer expiration) { expiration -= (llGetUnixTime() / 86400) *( RENT_RATE / 7); return llRound(expiration*0.8); } Link to comment Share on other sites More sharing options...
Leander Tyles Posted May 18, 2013 Author Share Posted May 18, 2013 return llRound(expiration*0.8); this line seems to cause me problems, script error "llDialog: button labels must be 24 or fewer characters long" i know i didnt provide any code involving dialogs but it only breaks when i use the GETREFUND function the word 'refund' comes up in the project alot but this is the only thing i see which involves the dialog mainMenu(uuid, msg + DLG_MSGd + partner + DLG_MSGe, unixExpiration, [iNFO_BTN, PARTNER_BTN, DESIGN_BTN, MOVE_BTN + "\t\t," + (string)getRefund(unixExpiration)]); Link to comment Share on other sites More sharing options...
Leander Tyles Posted May 18, 2013 Author Share Posted May 18, 2013 i done this integer getRefund(integer expiration) { expiration -= (llGetUnixTime() / 86400) * ( RENT_RATE / 7); llSay(0,(string)expiration); //return llRound(expiration*0.8); return expiration; } expiration is 1372158634 so * 0.8 would be 1097726907.2 i think this is whats crashing it Link to comment Share on other sites More sharing options...
Leander Tyles Posted May 18, 2013 Author Share Posted May 18, 2013 integer getRefund(integer expiration) { integer test = (((expiration - llGetUnixTime()) / 86400) * RENT_RATE / 7); return llRound(test*0.8); } i beleive i got it working, thanks 86400 seconds in a day, lets pretend i have 2 weeks left on my rental so: 14 days * the rental price which is 20 lindens = 280 280 / 7 = 40 which is correct if i rented a shop for 20L pw for 2 weeks it would come to L$40 so how the hell did we get from thier to -20% fee just using llround i wish i could understand it, the only thing different is the llround line and that only multiplys the test variable which was always present in my code to begin with o well if it works it works im happy Link to comment Share on other sites More sharing options...
Ela Talaj Posted May 18, 2013 Share Posted May 18, 2013 your code (very bad in style btw) is only going to work if getRefund() argument, which is expiration is Unix time also (number of seconds since Epoc), which I assumed would be the case. Apparently not, otherwise you would not be getting huge numbers. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now