CHAPTER 1
CHAPTER 2
CHAPTER 3
CHAPTER 4
CHAPTER 5
CHAPTER 6
CHAPTER 7
CHAPTER 9
CHAPTER 10
CHAPTER 11
CHAPTER 12
CHAPTER 14
CHAPTER 15
APPENDIC
E
S
301
CHAPTER 13
Figure 13.10: High-end networked vendors.
The lower one, from OnRez, sells a variety
of trees and special effects; the upper vendor,
from Hippo Technologies, rents real estate.
RENTALS AND SERVICES
We've talked about passing money directly to another avatar, and about exchanging money for objects.
The other main use for scripted money is to support rentals, either of services or of land.
A TICKET TO RIDE
Paying for access to a ride is pretty common. Rezzable's Surfline sims at Surfline Aloha Rezzable
<37, 141, 31> let you rent a surfboard to try out on their giant waves, you can go skydiving at Abbotts
Aerodrome (Abbotts <160, 148, 71>) , practice batting at a re-creation of historic Ebbets Field (Ebbets
Field <27, 169, 22>), or play golf at Holly Kai Golf Club (Hollywood <178, 236, 22>). Listing 13.10
implements a very simple example of a ride that will not let you play with it until you've paid.
Listing 13.10: Skyhook Ride
string gName;
key gKey = NULL_KEY;
integer gAltitude = 0;
displayLabel() {
string text = llGetObjectName();
if (gKey == NULL_KEY) {
text += "\nPay me L$1 per 100 meters and then sit for a ride";
} else {
text += "\nReserved for "+gName+ ": sit for a ride!";
}
llSetText(text, <1,0,0>, 1.0);
}
// insert moveTo(vector origin, vector destination) {} from Listing 2.4
CHAPTER 13
302
TRANSACTION
BASICS
REDISTRIBUTING
WEALTH
SELLING IT!
RENTALS AND
SERVICES
GAMBL...
UH... GAMES
OF SKILL
SUMMARY
default
{
state_entry() {
displayLabel();
llSetPayPrice(10, [PAY_HIDE, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
llSitTarget(<0,0,0.1>, ZERO_ROTATION);
}
money(key who, integer lindens) {
gName = llKey2Name(who);
gKey = who;
gAltitude += lindens;
llSay(0, "OK, "+gName+"! now sit and get a ride to "+
(string)(gAltitude*100) + " meters!");
llSetTimerEvent(30.0);
displayLabel();
}
changed(integer bits) {
if (bits & CHANGED_LINK) {
key av = llAvatarOnSitTarget();
if (av == gKey && av != NULL_KEY) {
llSay(0, "Hold on!!!");
integer i;
for (i=10; i>0; i--) {
llSay(0, (string)i+"...");
llSleep(1.0);
}
llShout(0, "Blast off!");
vector home = llGetPos();
vector dest = home+<0,0,gAltitude*100.0>;
moveTo(home, dest);
llUnSit(av);
moveTo(dest, home);
gKey = NULL_KEY;
gName = "";
gAltitude=0;
} else {
llSay(0, "Please pay me first");
llUnSit(av);
}
displayLabel();
}
}
timer() {
if (gKey != NULL_KEY) {
llSay(0, "Timing out: "+gName+" seems to have lost interest");
gKey = NULL_KEY;
gName = "";
gAltitude = 0;
displayLabel();
}
llSetTimerEvent(0.0);
}
}
This is really just a high-altitude intrasim teleporter, using the moveTo() function from Chapter 2.
The difference is that it won't operate until you've paid it. It sets up a payment box in state_entry()
to reserve the device. Once an avatar has paid it, he can sit and be transported straight up 100 meters
for every Linden dollar paid (to a maximum of 4,096m). When the avatar reaches the paid-for height, the
script unsits the passenger and returns home to reset. You could slow it down and offer the passenger a
parachute on the way up, or follow a path through a psychedelic panorama.

Get Scripting Your World: The Official Guide to Second Life® Scripting now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.