Role Play Community

Creative writing, Latest news, Character stories from the virtual world role-players

LaRPS : Legacies Role Play System » Support » Developer

ATM Bank Access Example v0.1

(1 post)
  1. TriJin | May 3, 2011 - 02:04 AM

    This will enable a player to access their own character bank balance and be able to deposit or retrieve their coins from that realm account.

    This requires the script "ATM.LaRPS.API.v.0.25" in the same object.


    integer speed = 8; // Change this number to change the speed of the animation.
    integer sides = 5; // Chnage this number to change which side to animate. Set it to 'ALL_SIDES' if you want to animate all sides of the prim.

    integer coins = 0;
    key CurrentUser = NULL_KEY;
    key requestid;
    key inrequestid;
    key outrequestid;

    list menucashlist1 = [ "Take 1", "Take 50", "Take 100", "Take 250", "Take 500", "Take 750", "Take 1000", "Take 5000"];

    integer MenuChan = -1;

    //\\::::::::::::::::::: LaRPS Constants ::::::::::::::::::://\\
    integer LaRPS_Event_Balance = -50000000;
    integer LaRPS_Event_BankMoneyRecd = -50000001;
    integer LaRPS_InitChan = -99990000;
    integer LaRPS_AnnounceObject = -99990001;
    integer LaRPS_AnnounceAsTarget = -99990002;
    integer LaRPS_AnnounceAsTargetNoMenu = -999900021;
    integer LaRPS_RequestBankBalance = -99990003;
    integer LaRPS_BankTakeAmount = -99990004;
    integer LaRPS_DisplayMemory = -99999999;
    //\\::::::::::::::::::::::::::::::::::::::::::::::::::::::://\\

    default
    {
    state_entry()
    {
    llSetTextureAnim(ANIM_ON | LOOP, sides,4,4,0,0,speed);
    llSetText( "", <1,1,1>, 1);

    // Initialise the object and begin listener
    llMessageLinked(LINK_THIS, LaRPS_InitChan, "", NULL_KEY);

    llListen(MenuChan, "", "", "");
    }

    on_rez(integer int)
    {
    //
    }

    touch_start(integer total_number)
    {
    // Announce this as a valid LaRPS object
    llMessageLinked(LINK_THIS, LaRPS_AnnounceObject, "", NULL_KEY);

    coins = 0;
    CurrentUser = llDetectedKey(0);

    // Get Bank balance from server
    llMessageLinked(LINK_THIS, LaRPS_RequestBankBalance, "", CurrentUser);

    // So the player can interact with this object
    llMessageLinked(LINK_THIS, LaRPS_AnnounceAsTargetNoMenu, "", CurrentUser);
    }

    link_message(integer sender, integer num, string msg, key id)
    {
    if(num == LaRPS_Event_Balance)
    {
    coins = (integer)msg;
    llDialog(CurrentUser,
    "LaRPS Bank Account:\n\nMoney in bank account: "+(string)coins+"\n\nChoose an amount to take out.", menucashlist1, MenuChan);
    }
    else
    if(num == LaRPS_Event_BankMoneyRecd)
    {
    coins = (integer)msg;
    llDialog(CurrentUser,
    "LaRPS Bank Account:\n\nMoney Given: "+(string)coins+"\n\nChoose an amount to take out.", menucashlist1, MenuChan);
    }
    }

    listen(integer chan, string name, key id, string msg)
    {
    // msg should be "take 999" where 999 is the amount.
    // CurrentUser is the key of the agent who receives the money
    // Event: LaRPS_Event_BankMoneyRecd is sent if successfull
    llMessageLinked(LINK_THIS, LaRPS_BankTakeAmount, msg, CurrentUser);
    }
    }


Reply

You must log in to post.

 

LaRPS™ :: Legacies Role Play System © TriJin Bade, GemX | software
Second Life®, SL™, are registered trademarks of their respective owners.
The features and the use of LaRPS the Legacies Role Play System is FREE and will always strive to be FREE to all users.
Any amount of donations are certainly appreciated to help keep the service up and running.