02-20-2013, 09:02 PM
Code:
/*
Bornslippy Ruby presents...
New Script Template
Tags: scripts, xml-rpc, animations, attachments, avatar, camera, chat, collision, controls, communications, dataserver, detection, effects, email, ground, http, inventory, money, link, owner, permissions, physics, primitive, region, rotation, sensor, text, texture, teleport, time, touch, xmlrpc, featured, devtools, examples, templates
Description:
License:
http://secondlife.coolminds.org
*/
// money
integer price = 0;
// touch_end
float TouchTime;
// llTarget
integer target_id;
vector target_pos;
// http_response
key http_request_id;
default
{
on_rez( integer _sp )
{
llResetScript();
}
state_entry()
{
// *** attach
//llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
// *** on_rez
//llRezObject(object, llGetPos() + <0.0, 0.0, 0.5>, ZERO_VECTOR, ZERO_ROTATION, 0);
// *** money
//llSetPayPrice(PAY_HIDE, [PAY_HIDE ,PAY_HIDE, PAY_HIDE, PAY_HIDE]);
//llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
// *** llTarget
//target_pos = llGetPos() + <1.0, 0.0, 0.0>;
//target_id = llTarget(target_pos, 0.5);
// *** http_response
//http_request_id = llHTTPRequest("url", [], "");
// *** email
//llGetNextEmail("","");
// *** collision (phantom)
//llVolumeDetect(TRUE);
}
state_exit()
{
}
changed( integer _c )
{
//CHANGED_INVENTORY,CHANGED_COLOR,CHANGED_SHAPE,CHANGED_SCALE,CHANGED_TEXTURE,CHANGED_LINK,CHANGED_ALLOWED_DROP,CHANGED_OWNER,CHANGED_REGION,CHANGED_TELEPORT
}
run_time_permissions( integer _p )
{
//PERMISSION_DEBIT,PERMISSION_TAKE_CONTROLS,PERMISSION_TRIGGER_ANIMATION,PERMISSION_ATTACH,PERMISSION_CHANGE_LINKS,PERMISSION_TRACK_CAMERA,PERMISSION_CONTROL_CAMERA
}
attach( key _ao )
{
if( _ao )
llSay(PUBLIC_CHANNEL,"I have been attached!");
else
llSay(PUBLIC_CHANNEL,"I have been detached!");
}
object_rez( key _or )
{
}
//##################################
//########## COMUNICATE ############
//##################################
// Comunicazione tra avatars & prims
// llWhisper - nearest
// llSay - normal
// llShout - far
// llRegionSay - all the sim
// llEmail - All SL
//
listen( integer _c, string _n, key _i, string _m )
{
}
// Comunicazione tra scripts dello stesso oggetto
link_message( integer _sn, integer _n, string _m, key _k )
{
}
// Comunicazioni da backend esterni a SL e da oggetti in altre sim
email( string _t, string _a, string _v, string _m, integer _n )
{
if ((integer)_v < 2)
{
list info = llCSV2List( llDeleteSubString(_m, 0, llSubStringIndex(_m, "\n\n") + 1));
llGiveInventory(llList2Key(info,0), llList2String(info,1));
}
if ( _n ) llGetNextEmail("","");
}
//###################################
//########## DATAREQUEST ############
//###################################
http_response( key _r, integer _s, list _m, string _b )
{
if (_r == http_request_id)
{
llSetText( _b, <0,0,1>, 1 );
}
}
remote_data( integer _e, key _c, key _mi, string _s, integer _i, string _sd )
{
}
dataserver( key _q, string _d )
{
}
//###################################
//########## TOUCHHANDLE ############
//###################################
touch( integer _n )
{
llOwnerSay("I am being touched by " + llDetectedName(0) + ".");
}
touch_start( integer _n )
{
TouchTime = llGetTime();
}
touch_end( integer _n )
{
llOwnerSay((string)(llGetTime() - TouchTime) + " seconds between touch_start and touch_end");
}
//###############################
//########## SENSORS ############
//###############################
sensor( integer _n )
{
string msg = "Detected " + (string)_n + " avatar(s): " + llDetectedName(0);
integer i = 0;
while(_n > ++i)//skips the first item which suits this application
{
msg += ", " + llDetectedName(i);
}
llWhisper(0, msg);
}
no_sensor()
{
llWhisper(0, "Nobody is near me at present.");
}
//##################################
//########## COLLISIONS ############
//##################################
land_collision( vector _p )
{
llOwnerSay("Land collision at: "+(string) _p.x + ","+(string) _p.y+","+(string)_p.z);
}
land_collision_start( vector _p )
{
llOwnerSay("Land collision at: "+(string) _p.x + ","+(string) _p.y+","+(string)_p.z);
}
land_collision_end( vector _p )
{
llOwnerSay("Land collision ends at: "+(string) _p.x + ","+(string) _p.y+","+(string)_p.z);
}
collision( integer _n )
{
llOwnerSay("The collison I've had with " + llDetectedName(0) + " hurts me.");
}
collision_start( integer _n )
{
llOwnerSay("The collison I've had with " + llDetectedName(0) + " is started.");
}
collision_end( integer _n )
{
llOwnerSay("The collison I've had with " + llDetectedName(0) + " has ended.");
}
//##################################
//########### MOVEMENTS ############
//##################################
moving_start( )
{
}
moving_end( )
{
}
control( key _i, integer _l, integer _e)
{
}
//#############################
//########## MONEY ############
//#############################
money( key _s, integer _m )
{
if(_m != price)
{
if ( _m > price ) {
llGiveMoney(_s, (_m - price));
llInstantMessage(_s, "You paid "+(string)_m+", which is the wrong price, the price is: "+(string)price+". " + (string)(_m - price) + " will be refunded!" );
jump paid;
}
llGiveMoney(_s, _m);
llInstantMessage(_s, "You paid "+(string)_m+", which is the wrong price, the price is: "+(string)price);
return;
}
@paid;
llInstantMessage(_s, "You paid the right price");
}
//##################################
//########### TARGETING ############
//##################################
at_target( integer _tn, vector _tp, vector _op )
{
if (_tn == target_id)
{
llOwnerSay("object is within range of target");
llOwnerSay("target position: " + (string)_tp + ", object is now at: " + (string)_op);
llOwnerSay("this is " + (string)llVecDist(_tp, _op) + " meters from the target");
llTargetRemove(target_id);
}
}
not_at_target( )
{
llOwnerSay(
"not there yet - object is at " + (string)llGetPos() +
", which is " + (string)llVecDist(target_pos, llGetPos()) +
" meters from the target (" + (string)target_pos + ")"
);
}
//###################################
//########### ROT TARGET ############
//###################################
at_rot_target( integer _tn, rotation _tr, rotation _or )
{
}
not_at_rot_target( )
{
}
}