Jump to content

Leander Tyles

Resident
  • Posts

    75
  • Joined

  • Last visited

Posts posted by Leander Tyles

  1. do you see a problem with this script?

    im never online to witness it, but here's what happens:

     

    every sunday thier should be 3 new winners announced, that all works fine.

    but when i log online the next morning, so monday.... i see thiers 3 new intirely different winners

    showing on the floating text so the lottery script must have took place again.

     

    this has happened for several weeks now

     

     

    string Day="Sunday";
    string WebPage="http://website.net/lottery.php";
    string HV_LastDate;
    key HV_Pay;
    string winner1 = "Tessymarie Resident";
    string winner2 = "FireTemp Resident";
    string winner3 = "Rosa Kenyon";
    
    
    string GetDay()
    {
        list weekdays = ["Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"];
        integer hours = llGetUnixTime()/3600;
        integer days = (hours + -7)/24;
        integer day_of_week = days%7;
        return llList2String(weekdays, day_of_week);
    }
    default
    {
        state_entry()
        {
            llSetText("PRIZE WINNERS:\n \n1st: " + (string)winner1 +"\n2nd: " + (string)winner2+ "\n3rd: " + (string)winner3,<1.0, 0.6, 0.2>,1.0);
            llSetTimerEvent(3600); // check the day of the week every hour
            llRequestPermissions(llGetOwner(),PERMISSION_DEBIT);
        }
        
         touch_start(integer num_detected)
         {
              llPlaySound("Drums",1.0); 
              llSay(0,"\n \n" + (string)winner1 + " won a free week\n" + (string)winner2 + " won L$10\n" + (string)winner3 + " won a gift-card");
              llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_NOTECARD, 0));
              return;
         }
        
        timer()
        {
            if(GetDay()==Day&llGetDate()!=HV_LastDate)
            {
                llHTTPRequest(WebPage,[],"");
                llSetTimerEvent(60);
            }
        }
    
        http_response(key request_id,integer status,list metadata,string body)
        {
            if(body!="false")
            {
                list A=llParseString2List(body,["|"],["|"]);
                llSetText("PRIZE WINNERS:\n \n1st: "+llList2String(A,0)+"\n2nd: "+llList2String(A,1)+ "\n3rd: "+llList2String(A,2),<1.0, 0.6, 0.2>,1.0);
    
                llPlaySound("Drums",1.0);
                llSay(0,"ANNOUNCING THE RESULTS\n \n" + llList2String(A,0)+" won an extra week\n" + llList2String(A,1)+" won the 10 lindens\n" + llList2String(A,2)+" won a giftcard");
    
                llInstantMessage(llList2String(A,3),"Congratulations, you just won 1 free week of rent.");
    
                llTransferLindenDollars(llList2String(A,4),10);
                llInstantMessage(llList2String(A,4),"Congratulations, you just won 10 lindens.");
    
                llGiveInventory(llList2String(A,5),llGetInventoryName(INVENTORY_OBJECT, 0));
                llInstantMessage(llList2String(A,5),"Congratulations, you just won a giftcard");
    
                llOwnerSay(llList2String(A,0)+" won extra week");
                llOwnerSay(llList2String(A,1)+" won 10 lindens");
                llOwnerSay(llList2String(A,2)+" won a giftcard");
                            
                winner1 = llList2String(A,0);
                winner2 = llList2String(A,1);
                winner3 = llList2String(A,2);
    
                HV_LastDate=llGetDate();
                llSetTimerEvent(3600);
            }
            else
            {
                llSetText("Database Failure",<1,1,1>,1);
            }
        }
    }

     

  2. WE ARE GIVING AWAY GIFT-CARDS,

    with them you can stay for 1 WEEK at highrise homes for Absolutly FREE !!!!!

     

    to recieve a card just send a inworld message to

    Hills90210 Beverly 

    http://slurl.com/secondlife/Monster/227/143/21/

     

    raygold1c.jpg

     

    thiers over 34 house designs and you get them all because they like a multi-scene system

    f3d09e82-8bf2-42a8-91e3-97dc1c7e8068wallpaper.jpg

     

    if you also happen to be a clubowner / host - we`ll give you a bunch of cards so you can help distribute them

  3. yea luckily i do record the uuids already,

    i just didnt want to record the house position on the webserver for multiple reasons, sim crash, server offline etc..

     

    heres all the infomation thats returned,

            list bodyCSV = llCSV2List(body);
            key uuid = llList2Key(bodyCSV, 0);
            string name = llList2String(bodyCSV, 1);
            key partneruuid = llList2Key(bodyCSV, 2);
            string partner = llList2String(bodyCSV, 3);
            string expiration = llList2String(bodyCSV, 4);
            integer unixExpiration = llList2Integer(bodyCSV, 5);
            string design = llList2String(bodyCSV, 6);

     

    your code example is very exciting to me, returning an avatars position and teleporting straight to them is alot simpler

    im concerned about problems that may occur if i do it this way tho

     

    1) partner may be in the sim but not neccaserily in thier apartment

    ( i could check if llovermyland perhaps but still no gaurantee that they in thier house)

     

    2) what if tenant+partner was both in the lobby waiting to use the teleporter, they wud be stuck in an endless loop thier

     

    hmm maybe i could just warn the person trying to teleport that thier partner is in the sim, would they like to goto them

     

    its a possibility i suppose, then if it fails they can say no next time :)

     

    and ofcourse if they are both in the lobby at the time, first person will have to ensure he presses No. so they get sent to the house and not to his partner probally standing beside him

  4. Hi,

     

    my project is rather confusing so ill tell you a little about what im trying to accomplish.

     

    i have a 'teleporter rental system' which purposly goes to random x,y,z positions everytime its used,

    im trying to make it so tenants+partners get sent to the same coordinates

     

    at the moment when a persons sits it checks the webserver in order to findout if they a tenant or not,

    then a bunch of infomation is returned

     

    included in the message body is wether that person has a partner or not, if they dont it`ll say "NONE"

     

          string partner = llList2String(bodyCSV, 3);

     

    -

    OK SO HERES THE PART I NEED HELP WITH

     

    [STEP 1]

     

    when a tenant sits on the teleporter, if they have a partner... check if thier name is in the list

     

    [STEP 2]

     

    if thier partner name is in the list, retreive thier coordinates so i can warp straight to it

     

    [STEP 3]

     

    if the person trying to teleport has a partner but thier name isnt in the list then

    record the sitting guys llGetPos() in the list when he reaches the destination

     

    -------

    then hopefully everything should work out.

     

    can sombody provide me with code examples to achieve my goal, im terrible with lists they always confuse me.

    i tried to make a subscription kiosk in the past, didnt goto well

     

    ill try to learn from visitor greeter scripts or groupjoin signs they usualy involve lists

     

    saving the coords on the webserver might be easier solution but too many problems i dont want to think about.

     

    only thing i have to worry about this way is the list becoming to large and crashing the script

     

     

     

     

     

     

     

     

     

  5. thanks guys one last question

    how do i make it say 10% instead of 10.00

     

    apart from changing it from a float or typing it into the message,

    i dont realy understand the getsubstring line

     

            if (weeks >= PAY_AT_LEAST)
            {
            integer cashback = (integer)((amount*DISCOUNT)/100);
            string strDiscount=llGetSubString((string)DISCOUNT,0,llSubStringIndex((string)DISCOUNT,".")+2);   

            msg = "Paying for " + (string)PAY_AT_LEAST + " weeks or more at once means a discount of " +(string)strDiscount+  "%; refunding L$" + (string)cashback + ".";
            
            llSay(0,msg);
            llGiveMoney(id, cashback);  
            }

     

    Paying for 4 weeks or more at once means a discount of 10.00%; refunding L$8.

  6. Hi,


    anybody help?


    i cant figure out how to offer a 10% discount if a tenant rents 4 weeks in advance

    i understand if i charge 20L pw and i recieved 80L.

    if amount / rent_rate = 4 means they eligible for discount

    but that formula dont work if they rent several months in advance.


    anyway if a person pays a month in advance, or several months i want to return 10% of the amount they paid

    --

    hippotech got this in thier config

    DISCOUNT PAY AT LEAST: 4 < handles any amount of weeks
    DISCOUNT PERCENTAGE: 5%


    i want my system to work the same way

     

    keep in mind people have to pay the correct amount because they already refunded if wrong

     

     

    money(key id, integer amount)
        {
            integer overPay = amount % RENT_RATE;
            if (paidLock)
            {
                llInstantMessage(id, "rental box is in use, try again in a minute or two");
                llGiveMoney(id, overPay); return;
            }
    
            integer weeks = amount / RENT_RATE; string msg = REFUND_MSG + (string)overPay;
            if (overPay && REFUND)
            {
                if (weeks) msg = "You have overpaid." + msg;
                else msg = "The minimum rent is L$" + (string)RENT_RATE + msg;
                llGiveMoney(id, overPay); llInstantMessage(id, msg); if (!weeks) return;
            }
    
            resetTimer(); paidName = llKey2Name(id); paidLock = TRUE;
            updateReqId = llHTTPRequest(UPDATE_URL +
                    "?uuid=" + (string)id + "&name=" + llEscapeURL(llKey2Name(id)) +
                    "&weeks=" + (string)weeks, [], "");
        }

     

  7. i beleive i could do something like this

    float WEB_TIMEOUT = 30.0;

     

    then initiate a timer when i do a llHTTPRequest

    llSetTimerEvent(WEB_TIMEOUT);

     

    then in the http_responce if infomation is recieved end the timer otherwise

     

    timer()
    {
    llSay(0,"trouble communicating with webserver...\nplease try using the gift-card again later or contact the owner " + llKey2Name(llGetCreator())); return;
    }

     

    i havent tried it yet tho and im open to any other ideas cuz i would prefer the checking if status == 200 way

     

    AH I THINK I GOT IT NOW, 200 IS GOOD != 200 IS A BAD THING :)


  8. thanks for the responce,

    your answers opened up my eyes especially #3

    anyway i pretty much done everything i wanted to do now.

     

    yes i do use an external database.. i cant keep track of whos who serverside because i barely know lsl let alone php

    but i managed to make this giftcard system by editing my rentbox,
    the giftcard itself pratically functions the sameway the rentbox does so its quite dangerous if abused.

     

    hopefully in future i can keep track of sales in sl kinda like hippotech payment history menu does

    - just out of interest not a security measure

     

    anyway back on track  i have a few questions, problems and concerns:

     

    1) is thier anyway to use lldie if im wearing the giftcard?

     

    2) i checked if status == 200

    but then it never works, it will always say

    llSay(0,"trouble communicating with webserver...\nplease try using the gift-card again later or contact the owner " + llKey2Name(llGetCreator())); return;

     

    if i remove that line then it works a treat

    i dont know what the problem is so i cant fix it :(

     

    3) im concerned about the USED variable..... i just want to make sure people cant reset my script to use the giftcard again because its very dangerous to my buissness if it wont lldie();

     

    4) always wondered how i post code on forums so it appears formatted like lsl

     

    UPDATED CODE:

    integer TIME_GIFT = 1; // number of weeks to give awayinteger RENT_RATE = 20; // price you usually charge for a single weekstring USED;string DELETESELF = "TRUE";string NOTE = "INFO";string UPDATE_URL = "http://mywebhost.com";string OLD_RENT_MSG = "[LEASE EXTENDED] ";string NEW_RENT_MSG = "[LEASE STARTED]";string RENT_PAID_MSG =  " Time left: ";string OWNER_OLD_RENT_MSG = " has renewed thier rental. Time left: ";string OWNER_NEW_RENT_MSG = " has rented a skybox thier rent. Time left: ";list DESIGN_DLG_BTNS = ["Studio","Noir","Gala","Circle","Shindig","Breeze","Tropical","Stable","Fab","Posh","Bash","Suttle","Zephyr","Chill","Sunset","Beach","Cross","Dip","Escape","Loft","Sweet","Garret","Turn","Party","Small","Modern","Homely","Smart","Marble","Silver","Alley","Grunge","Relax","Submarine","Cardboard","NYC1","NYC2","Escort","Triangle","Realistic"];key checkReqId;key updateReqId;key addReqId;key removeReqId;key deleteReqId;key designReqId;key avatarKey;key creatorThisPrim;string ts2Days(integer unixExpiration){    integer seconds = unixExpiration - llGetUnixTime(); integer weeks = seconds / 604800;    integer days = seconds / 86400; integer hours = (seconds % 86400) / 3600;    integer mins = (seconds % 3600) / 60; string time = "";    if (weeks) { time += (string)weeks + " week"; if (~-weeks) time += "s"; time += " "; }    if (days) { time += (string)days + " day"; if (~-days) time += "s"; time += " "; }    if (hours) { time += (string)hours + " hour"; if (~-hours) time += "s"; time += " "; }    if (mins) { time += (string)mins + " min"; if (~-mins) time += "s"; }    return time;}resetReqId(key respId){    if (respId == checkReqId) { checkReqId = NULL_KEY; }    else if (respId == updateReqId) updateReqId = NULL_KEY;    else if (respId == addReqId) addReqId = NULL_KEY;    else if (respId == removeReqId) removeReqId = NULL_KEY;    else if (respId == deleteReqId) deleteReqId = NULL_KEY;}default{ state_entry() { USED = "FALSE"; llRequestPermissions( llGetOwner(), PERMISSION_ATTACH ); creatorThisPrim = llGetCreator(); // doesnt rename item in inventory llSetObjectName((string)TIME_GIFT + " WEEK Gift Card - (wear me)"); llSetText("\n" + (string)TIME_GIFT + " weeks vacation", <1.0, 1.0, 1.0>, 1.0); llSetObjectDesc("Card Value: L$" + (string)(TIME_GIFT * RENT_RATE)); } changed(integer change) { if (change & CHANGED_OWNER) llResetScript(); } on_rez(integer rez) { if (!llGetAttached() )        //reset the script if it's not attached. llResetScript();       }  attach(key id)    {        if (id != NULL_KEY && USED == "TRUE")        {        // doesnt rename inventory object so kinda pointless        llSetObjectName((string)TIME_GIFT + " WK HH Gift Card (USED)");        llSetObjectDesc("may aswell delete this object now");        }        if (id != NULL_KEY && USED == "FALSE")            llSetObjectName((string)TIME_GIFT + " WK HH Gift Card");            // do it in state entry anyway            llSetObjectDesc("Card Value: L$" + (string)(TIME_GIFT * RENT_RATE));            if (llGetInventoryType(NOTE) == INVENTORY_NOTECARD)            llGiveInventory(llDetectedKey(0), NOTE);        else            llSetObjectName((string)TIME_GIFT + " WK HH Gift Card - (wear me)");    }      // when worn and activated   touch(integer num_detected)    {                if (llDetectedKey(0) != llGetOwner())        {            llOwnerSay(llDetectedName(0) + " touched your giftcard.");            llSay(0,llKey2Name(llGetOwner()) + " has a giftcard for highrise homes.");            llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_LANDMARK, 0));        }        if (llDetectedKey(0) == llGetOwner() && USED == "TRUE")        {        llSay(0,"You have already claimed your free Gift");        }        if (llDetectedKey(0) == llGetOwner() && USED != "TRUE")        {        avatarKey = llDetectedKey(0);        integer weeks = TIME_GIFT;        updateReqId = llHTTPRequest(UPDATE_URL +                "?uuid=" + (string)avatarKey + "&name=" + llEscapeURL(llKey2Name(avatarKey)) +                "&weeks=" + (string)weeks, [], "");    }}    http_response(key respId, integer status, list meta, string body)    {        if (status == 200)        {        // Could set used to false but may cause unnecasery problems.        llSay(0,"trouble communicating with webserver...\nplease try using the gift-card again later or contact the owner " + llKey2Name(llGetCreator())); return;        }               if (status != 200) { resetReqId(respId); return; }        list bodyCSV = llCSV2List(body); key uuid = llList2Key(bodyCSV, 0);        string name = llList2String(bodyCSV, 1); key partneruuid = llList2Key(bodyCSV, 2);        string partner = llList2String(bodyCSV, 3);        string expiration = llList2String(bodyCSV, 4);        integer unixExpiration = llList2Integer(bodyCSV, 5);        string design = llList2String(bodyCSV, 6); integer idx; string msg;                if (respId == updateReqId)        {            string time = llList2String(llCSV2List(ts2Days(unixExpiration)), 0);            if (design == "NEW") // A NEW TENANT            {                msg = NEW_RENT_MSG + " ";                llPlaySound("sound",1.0);                                  integer randIdx = (integer)llFrand(21.0);        string randomDesign = llList2String(DESIGN_DLG_BTNS, randIdx);        llHTTPRequest(UPDATE_URL +                "?uuid=" + (string)uuid + "&name=" + llEscapeURL(llKey2Name(uuid)) +                "&design=" + randomDesign, [], "");                                if (llGetInventoryType(NOTE) == INVENTORY_NOTECARD)                    llGiveInventory(uuid, NOTE);                                llSay(0, msg + RENT_PAID_MSG + time);                                llInstantMessage(uuid,"You have been assigned '" +randomDesign+ " Pad' but you can change it anytime.");              if (uuid != creatorThisPrim)              // notify owner of gift cards being used?               llInstantMessage(uuid, msg + name + OWNER_NEW_RENT_MSG + time);            } else // ALREADY A TENANT SO LEASE EXTENDED            {                msg = OLD_RENT_MSG;                string userMsg = msg + RENT_PAID_MSG + time;                string ownerMsg = msg + name + OWNER_OLD_RENT_MSG + time;                if (partner != "NONE")                llSay(0, userMsg);                llInstantMessage(partneruuid, (userMsg));                 // notify owner of gift cards being used?                if (uuid != creatorThisPrim) llInstantMessage(creatorThisPrim, ownerMsg);            }            // got a responce so           USED = "TRUE";        llSetText("\n" + (string)TIME_GIFT + " weeks vacation (USED)", <1.0, 1.0, 1.0>,1.0);        llSetObjectName((string)TIME_GIFT + " WK HH Gift Card (USED)");        llSetObjectDesc("may aswell delete this object now");        llOwnerSay("Here's a LM to the office incase you dont know where it is, please accept");        llGiveInventory(uuid,llGetInventoryName(INVENTORY_LANDMARK, 0));        llSleep(3.0);        if (DELETESELF == "TRUE") { llDie(); } // doesnt work if worn.        }    }} 

     

    please scroll up to help with current problems thank you

  9. Hello, can anybody help finish this script......

    its a gift card system for my rentbox so works a little differently than what you may find in a shop

    its just missing 4 features - help with any of them atall will be appreciated

     

    1) make sure this giftcard can only be used once, then delete itself.

    2) how to use the card? well im wearing it already so maybe touch for a menu or chat-command to confirm?

    3) how do i check if im in a script enabled area? if people use the giftcard in a no scriptzone it`ll be used and useless

    4) check for webserver responce to ensure its online? otherwise giftcard might get used and become useless again

     

    string USED = FALSE;
    integer TIME_GIFT = 1; // number of weeks to give away
    integer RENT_RATE = 50; // price you usually charge for a single week
    string NOTE = "INFO";
    string UPDATE_URL = "http://mywebhost.com";
    string OLD_RENT_MSG = "[LEASE EXTENDED] ";
    string NEW_RENT_MSG = "[LEASE STARTED]";
    string RENT_PAID_MSG =  " Time left: ";
    string OWNER_OLD_RENT_MSG = " has renewed thier rental. Time left: ";
    string OWNER_NEW_RENT_MSG = " has rented a skybox thier rent. Time left: ";
    
    list DESIGN_DLG_BTNS = [
    "1",
    "2",
    "3",
    "4",
    "5",
    "6",
    "7",
    "8",
    "9",
    "10",
    "11",
    "12",
    "13",
    "14",
    "15",
    "16",
    "17",
    "18",
    "19",
    "20",
    "21",
    "22",
    "23",
    "24",
    "25",
    "26",
    "27",
    "28",
    "29",
    "30",
    "31",
    "32",
    "33",
    "34",
    "35",
    "36",
    "37",
    "38",
    "39",
    "40"
    ];
    
    key checkReqId;
    key updateReqId;
    key addReqId;
    key removeReqId;
    key deleteReqId;
    key designReqId;
    
    key avatarKey;
    key creatorThisPrim;
    
    string ts2Days(integer unixExpiration)
    {
        integer seconds = unixExpiration - llGetUnixTime(); integer weeks = seconds / 604800;
        integer days = seconds / 86400; integer hours = (seconds % 86400) / 3600;
        integer mins = (seconds % 3600) / 60; string time = "";
        if (weeks) { time += (string)weeks + " week"; if (~-weeks) time += "s"; time += " "; }
        if (days) { time += (string)days + " day"; if (~-days) time += "s"; time += " "; }
        if (hours) { time += (string)hours + " hour"; if (~-hours) time += "s"; time += " "; }
        if (mins) { time += (string)mins + " min"; if (~-mins) time += "s"; }
    
        return time;
    }
    
    resetReqId(key respId)
    {
        if (respId == checkReqId) { checkReqId = NULL_KEY; }
        else if (respId == updateReqId) updateReqId = NULL_KEY;
        else if (respId == addReqId) addReqId = NULL_KEY;
        else if (respId == removeReqId) removeReqId = NULL_KEY;
        else if (respId == deleteReqId) deleteReqId = NULL_KEY;
    }
    
    default
    {
     state_entry() {
     llRequestPermissions( llGetOwner(), PERMISSION_ATTACH );
     creatorThisPrim = llGetCreator();
     // doesnt rename item in inventory
     llSetObjectName((string)TIME_GIFT + " WEEK Gift Card - (wear me)");
     llSetText("Gift Card\n" + (string)TIME_GIFT + " weeks vacation", <1.0, 1.0, 1.0>, 1.0);
     llSetObjectDesc("Card Value: L$" + (string)(TIME_GIFT * RENT_RATE));
     }
     changed(integer change) { if (change & CHANGED_OWNER) llResetScript(); }
     on_rez(integer rez)
     {
     if (!llGetAttached() )        //reset the script if it's not attached.
     llResetScript();      
     }
     
     attach(key id)
        {
            if (id)
                llSetObjectName((string)TIME_GIFT + " WK HH Gift Card ");
            else
                llSetObjectName((string)TIME_GIFT + " WK HH Gift Card - (wear me)");
        }
        
      // when worn and activated
       touch(integer num_detected)
        {
            avatarKey = llDetectedKey(0);
            integer weeks = TIME_GIFT;
    
            updateReqId = llHTTPRequest(UPDATE_URL +
                    "?uuid=" + (string)avatarKey + "&name=" + llEscapeURL(llKey2Name(avatarKey)) +
                    "&weeks=" + (string)weeks, [], "");
        }
    
    
        http_response(key respId, integer status, list meta, string body)
        {
            if (status != 200) { resetReqId(respId); return; }
    
            list bodyCSV = llCSV2List(body); key uuid = llList2Key(bodyCSV, 0);
            string name = llList2String(bodyCSV, 1); key partneruuid = llList2Key(bodyCSV, 2);
            string partner = llList2String(bodyCSV, 3);
            string expiration = llList2String(bodyCSV, 4);
            integer unixExpiration = llList2Integer(bodyCSV, 5);
            string design = llList2String(bodyCSV, 6); integer idx; string msg;
            
            if (respId == updateReqId)
            {
                string time = llList2String(llCSV2List(ts2Days(unixExpiration)), 0);
                if (design == "NEW") // A NEW TENANT
                {
                    msg = NEW_RENT_MSG + " ";
                    llPlaySound("sound",1.0);
                              
            integer randIdx = (integer)llFrand(21.0);
            string randomDesign = llList2String(DESIGN_DLG_BTNS, randIdx);
            llHTTPRequest(UPDATE_URL +
                    "?uuid=" + (string)uuid + "&name=" + llEscapeURL(llKey2Name(uuid)) +
                    "&design=" + randomDesign, [], "");
                    
                    if (llGetInventoryType(NOTE) == INVENTORY_NOTECARD)
                        llGiveInventory(uuid, NOTE);
                    
                    llSay(0, msg + RENT_PAID_MSG + time);
                    
                    llInstantMessage(uuid,"You have been assigned '" +randomDesign+ " Pad' but you can change it anytime.");
    
                  if (uuid != creatorThisPrim)
                  // notify owner of gift cards being used?
                   llInstantMessage(uuid, msg + name + OWNER_NEW_RENT_MSG + time);
                } else // ALREADY A TENANT SO LEASE EXTENDED
                {
                    msg = OLD_RENT_MSG;
                    string userMsg = msg + RENT_PAID_MSG + time;
                    string ownerMsg = msg + name + OWNER_OLD_RENT_MSG + time;
                    if (partner != "NONE")
                    llSay(0, userMsg);
                    llInstantMessage(partneruuid, (userMsg));
                     // notify owner of gift cards being used?
                    if (uuid != creatorThisPrim) llInstantMessage(creatorThisPrim, ownerMsg);
                }
            }
        }
    }

     



  10. okie after comparing all the codes given to me, i done it this way

     

        if (weeks) return time + ",SUPERB";
        else if (days >= 4) return time + ",OK";
        else return time + ",EXPIRING";

    which has seemed to work

    i put RETURN before each one.... ive no idea why thats any different but if it works it works

     

    OMG im back to the origional problem again

    Your rent expires in 6 days 23 hours 53 mins,SUPERB <<<<

     

    maybe i can parse the string ???? never had to in the past using the first code

     "\nYour rent expires in " + ts2Days(unixExpiration));

  11. i got it working, removing the = signs helped... i dont understand it but im glad i tried it

     

    time + ", OK"

     

    ah damnit, everytime i think i fixed something, another issue occurs

     

    if i leave the += signs in, then timeleft aint displayed on my dialogs

    if i do it myway just the + signs, then timeleft is displayed but the status which is (OK/EXPIRING/SUPERB) aint displayed

    so frustrating

  12. great tyvm

     

    ah another problem occured, i almost overlooked.... the old code worked

     

    string ts2Days(integer unixExpiration)
    {
        integer seconds = unixExpiration - llGetUnixTime(); integer weeks = seconds / 604800;
        integer days = (seconds % 604800)  / 86400; integer hours = (seconds % 86400) / 3600;
        integer mins = (seconds % 3600) / 60; string time = "";
        if (weeks) { time += (string)weeks + " week"; if (~-weeks) time += "s"; time += " "; }
        if (days) { time += (string)days + " day"; if (~-days) time += "s"; time += " "; }
        if (hours) { time += (string)hours + " hour"; if (~-hours) time += "s"; time += " "; }
        if (mins) { time += (string)mins + " min"; if (~-mins) time += "s"; }
    /*
        if (days < 4) return time + ",EXPIRING"; else if (days > 6) return time + ",SUPER";
        else return time + ",OK";
    */
        return time;
    }

     

    rental time is returned fine for example:

    Your rent expires in 6 days 23 hours 50 mins


    but when i use your code i get

    Your rent expires in 6 days 23 hours 53 mins,OK


    notice the OK ^ in the msg

     

    time += ", OK";

     

    i tried removing the space between the , and OK but that didnt do the job

    i have no idea what the problem is... then again i didnt earlier either :(

  13. thank you, that done the trick


    it caused a new problem now tho which i dunno how to solve, with the last part of the code

     

        if (days < 4) return time + ",EXPIRING"; else if (days > 6) return time + ",SUPERB";
        else return time + ",OK";


    it always says "OK" even if i rent far in advance.

  14. please help me with time convertor problem,

    string ts2Days(integer unixExpiration)
    {
        integer seconds = unixExpiration - llGetUnixTime(); integer weeks = seconds / 604800;
        integer days = seconds / 86400; integer hours = (seconds % 86400) / 3600;
        integer mins = (seconds % 3600) / 60; string time = "";
        if (weeks) { time += (string)weeks + " week"; if (~-weeks) time += "s"; time += " "; }
        if (days) { time += (string)days + " day"; if (~-days) time += "s"; time += " "; }
        if (hours) { time += (string)hours + " hour"; if (~-hours) time += "s"; time += " "; }
        if (mins) { time += (string)mins + " min"; if (~-mins) time += "s"; }

        if (days < 4) return time + ",EXPIRING"; else if (days > 6) return time + ",SUPERB";
        else return time + ",OK";
    }

    when i rent or extend my lease to be told how much time i have left, it`ll say something like this

    [LEASE EXTENDED]  Time left: 2 weeks 16 days 21 hours 54 mins

    thats the issue ^


    i dont realy have 2 weeks and 16 days left, - thiers just 2 weeks IN 16 days with TWO days left over.

    so instead of saying what it does, it should say Time left: 2 weeks 2 days 21 hours 54 mins

     

    ive looked at several open source scripts but they dont do weeks

    http://wiki.secondlife.com/wiki/Rental_Cube

    http://patrioticnigras.org/wiki/index.php?title=Rental_Script

     

     

     

  15. thanks for all your advice, i found a simple solution which seems to work for me

    if ((integer)expiration == (integer)NULL_KEY) // then they aint a tenant because its blank 

    and im glad you mentioned casting a string only equals the year, i thought as much in my earlier posts

    i will try to convert my project to use llGetUnixTime() if im upto it but it works great for now

     

     

     

  16. i tried changing if ((integer)expiration != (integer)llGetTimestamp())

    to != llGetUnixTime but that didnt work atall so expiration is also the problem hmmm

     

    would i be right in thinking the problem is on my webserver with the way the php stores the expiry date in the database?

    i havent a clue about any of this so if thats the case ill go hire a php guy


    stamp.JPG

  17. Hi,


    im not realy a scriptor.. i had a custom rentbox made in the past and ive been trying to improve it over the years, so i know a little


    anyway i just found a huge bug which has been annoying me for a longtime, its funny because i always felt the problem got worse everytime christmas approached... yes i been living with it for that long

     

    long story short my rentbox slash teleport system

    checks if the avatar ISNT a tenant by using the code below

                if ((integer)expiration != (integer)llGetTimestamp())
                {
                llSay(0,"\n" + (string)expiration + "\n" + llGetTimestamp()); // i added this to see whats going on
                llUnSit(gAvatarID);
                llSay(0,"\n \nYOU ARE NOT A TENANT, " + llKey2Name(gAvatarID) +


    HERE ARE MY FINDINGS:

     

    when my system works it says:

    2013-10-05 23:41:58                 // expiration
    2013-05-18T23:42:41.464428Z      // llgettimestamp


    when my system messes up it says:

    2014-01-18 23:41:58                 // expiration
    2013-05-18T23:44:05.375520Z      // llgettimestamp


    thats the problem, even tho i am a tenant.. when i rent too far in advance it`ll claim im not a tenant and unsit me.

    i dont realy understand how it ever worked atall to be honest i mean the 2 variables never match anyway, only the first 4 digits >?

     

    anyway have you noticed the important detail which has changed !?

    I BELEIVE ITS BECAUSE THE YEAR DOESNT MATCH (2014)


    what can i do to fix my problem

    i presume its something simple like changing (integer)llGetTimestamp())  to some thing else

     

    please help me i maybe wrong altogether but the year changing is the only time my system seems to screw up

     

     some more detailed results

     

    when im not a tenant, date stays the same except for last digits
    it unsits me as it should do so works fine

    2013-05-19T00:37:35.403233Z

    when im a tenant with 29 weeks rent payed it still works fine

    2013-12-15 00:40:52
    2013-05-19T00:41:08.498774Z

    when im a tenant with 31 weeks payed it still works fine

    2013-12-29 00:43:05
    2013-05-19T00:43:34.494680Z

    But when im a tenant with 32 weeks payed
    it says im not a tenant & unsits me...
    the expiry year would be 2014

    2014-01-05 00:40:52
    2013-05-19T00:42:20.940989Z

  18. 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

  19. 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

  20. 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)]);

     

  21. 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

     

     

     

     

  22. lindens just restarted the sim so i cant get online to play around a mo but

    this is a plugin, another script contacts this one... sending the persons key so we know who to send the first dialog too

    since that part works i dont know at what stage i would use your method but i guess i could try creating more variables to hold the id yes

×
×
  • Create New...