Jump to content

Lestate Claven

Resident
  • Posts

    1
  • Joined

  • Last visited

Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. 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 !"); }}
×
×
  • Create New...