Difference between revisions of "LlGetText"

From Second Life Wiki
Jump to navigation Jump to search
m
(Redirected page to PRIM TEXT)
 
Line 1: Line 1:
{{LSL_Function
#redirect [[PRIM_TEXT]]
|func_id
|mode=request
|func=llGetText
|sort=GetText
|return_type=string
|func_desc
|return_text=with the content of the Text inserted with llSetText.
|spec
|examples=
<lsl>
//Script that count the times touched
//Author: David Thurman
integer counter;
default
{
touch_end(integer i)
{
integer data = (integer)llGetText();
counter = data + 1;
llSetText((string)counter, <1,0,1>,1);
}
}
</lsl>
 
<lsl>
//Script that count the amount of money donated:
//Author: David Thurman
string text;
default
{
    state_entry()
    {
        llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
    }
    run_time_permissions(integer perm)
    {
        if(perm & PERMISSION_DEBIT)
            state cash;
    }
}
state cash
{
    money(key id, integer amount)
    {       
      text = llGetText(); //this text is preformated as seen in the llSetText below.
      integer balance = (integer)llGetSubString(text, 25, -1); //Extract the value of the previus balance from the text.
      integer total = balance + amount; //Add the balance with the amount of money donated
      llSetText("Total of money donated: L$" + (string)total, <1,0,1>,1); //Update the Text with the new total.
    }
}
</LSL>
|helpers
|related
|also
|notes=The link for the related Jira is this: [https://jira.secondlife.com/browse/SVC-5384 Jira for llGetText].}}

Latest revision as of 02:01, 9 April 2011

Redirect to: