Jump to content

Looking for a "Incrase Price after every pay "Script


Fleischgeiger
 Share

You are about to reply to a thread that has been inactive for 3015 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hi guys =)

 

first of all, sorry for my bad english =)

second of all...im a totally noob in scripting...

 

I need a script that do something like this.

 

First costumer pays a box 1L$ and get a item that is in the box. The second costumer need to pay 2L$ to get that object in the box...the third needs to pay 3L$ and the fourth 4L$ and so on. Basically the cost of the item increases by 1 $L everytime.

 

It would be great if the current cost would be in a hovertext over the box. And it would be awesome if you could set the price increase through a menu and a starting price. So you could say ||Starting Price 100 L$ and the price Incrase by 10L$ each time anyone pay the Box||. And a option to "reset" that whole thing would be aweome =)

 

Anyone who could help me out?

 

Thank you :3

 

Link to comment
Share on other sites

Hi Fleischgeiger,

see if that can be great: 

integer price = 1;integer increase = 1;integer mPrice = -1;integer listenHandler;startListen(integer c, string n, key k, string m, float t) {  llSetTimerEvent(t);  listenHandler = llListen(c, n, k, m);}stopListen() {  llSetTimerEvent(0);  llListenRemove(listenHandler);}integer isNum(string data) {  list ret = llParseString2List(data, ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], []);  if (llGetListLength(ret) != 0) return FALSE;  return TRUE;}default {    on_rez(integer num) {llResetScript();}    state_entry() {        llSetText("", <1,1,1>, 1);        llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);    }    run_time_permissions(integer perm) {        if(perm & PERMISSION_DEBIT)        state setup;    }}state setup {    on_rez(integer num) {llResetScript();}    state_entry() {        llSetText("Setup", <0,1,0>, 1);    }    touch_start(integer total_number) {        integer i;            for (i = 0; i <= total_number; ++i) {            if (llDetectedKey(i) == llGetOwner()) {                 startListen(80, "", llGetOwner(), "", 30.0);                llDialog(                    llGetOwner(),                    "INFO\nPrice: " +(string)price + "\nIncrease: "+(string)increase ,                    ["On", "Price", "Increase"],                    80);            }        }      }  listen(integer c, string n, key k, string m) {    if (c == 80) {      if (m == "On") state sell;      else if (m == "Price") {        stopListen();        startListen(20, "", llGetOwner(), "", 30.0);        llTextBox(llGetOwner(), "set default price", 20);      }      else if (m == "Increase") {        stopListen();        startListen(30, "", llGetOwner(), "", 30.0);        llTextBox(llGetOwner(), "set default increase", 30);      }    }    else if (c == 20 || c == 30) {      if (isNum(m)) {        if (c == 20) {          if ((integer)m <= 0) {            llTextBox(llGetOwner(), "Price: the number must be upper than 0", c);            return;          }          stopListen();          price = (integer)m;          mPrice = price;          llOwnerSay("Price: " + m);        }        else {          if ((integer)m < 0) {            llTextBox(llGetOwner(), "Increase: the number must be prositive", c);            return;          }          stopListen();          increase = (integer)m;          llOwnerSay("Increase: " + m);        }      }      else llTextBox(llGetOwner(), "use only numbers", c);    }  }  timer() {    stopListen();    llOwnerSay("Listen time out !");  }}state sell {    on_rez(integer num) {llResetScript();}    state_entry() {        llSetText("Price: " +(string)price, <1,1,1>, 1);        llSetPayPrice(PAY_HIDE, [price ,PAY_HIDE, PAY_HIDE, PAY_HIDE]);    }    money(key id, integer amount) {        if(amount != price) {            llGiveMoney(id, amount);            llInstantMessage(id, "you payed "+(string)amount+", that is not the good price, the price is : "+(string)price);        }        else {            price += increase;            llSetText("Price: " +(string)price, <1,1,1>, 1);            llSetPayPrice(PAY_HIDE, [price ,PAY_HIDE, PAY_HIDE, PAY_HIDE]);            llGiveInventory(id,llGetInventoryName(INVENTORY_OBJECT,0));        }    }    touch_start(integer total_number) {        integer i;            for (i = 0; i <= total_number; ++i) {            if (llDetectedKey(i) == llGetOwner()) {                 startListen(80, "", llGetOwner(), "", 30.0);                llDialog(                    llGetOwner(),                    "INFO\nPrice: " +(string)price + "\nIncrease: "+(string)increase ,                    ["Off", "Reset", "Restart"],                    80);            }        }      }    listen(integer c, string n, key k, string m) {        if (c == 80) {            if (m == "Off") state setup; //return to the setup state            else if (m == "Reset") { //set the price to the lastest price setup even this one is the default configuration                if (mPrice != -1) price = mPrice;                else price = 1;                llSetText("Price: " +(string)price, <1,1,1>, 1);                llSetPayPrice(PAY_HIDE, [price ,PAY_HIDE, PAY_HIDE, PAY_HIDE]);            }            else if (m == "Restart") llResetScript();        }    }    timer() {        stopListen();        llOwnerSay("Listen time out !");    }}
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3015 days.

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
 Share

×
×
  • Create New...