Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Camping Camp  

Camp

Camp

Category: Camping
By : Encog Dod
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Camp
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Camp_1.lsl
Get file # 2. Camp_2.lsl
1 integer campmoney = 0;
2 integer campadd = 2;
3 integer camptime = 300;
4 integer campcycle = 2;
5 integer cyclesLeft = 0;
6 string reciever;
7
8 // for loading notecard
9 string notecardName;
10 key notecardQuery;
11 integer notecardIndex;
12
13 displayText()
14 {
15 if( reciever!=NULL_KEY )
16 {
17 if( campcycle>0 )
18 {
19 llSetText("Money:"+(string)campmoney + "\nCycles Left: " + (string)cyclesLeft,<0,0,0>,1);
20 }
21 else
22 {
23 llSetText("Money:"+(string)campmoney,<0,0,0>,1);
24 }
25 }
26 else
27 {
28 llSetText("Sit here for free money,\nL$"
29 +(string)campadd+" every "
30 +(string)(camptime/60)+" minutes.",<0,0,0>,1);
31 }
32
33
34 }
35
36 default
37 {
39 {
41 }
42
44 {
46 }
47
48 run_time_permissions (integer perm)
49 {
50 if(perm & PERMISSION_DEBIT)
51 {
52 notecardName = "Config";
53 state loading;
54 }
55 }
56 }
57
58 state ready
59 {
61 {
62 reciever = NULL_KEY;
63 displayText();
64 llSitTarget(<0, 0, 1>, ZERO_ROTATION);
65 }
66
67 touch_start(integer num_detected)
68 {
70 {
71 llSay(0,"Camping pad resetting.");
73 }
74 }
75
76 changed(integer change)
77 {
78 if(change & CHANGED_LINK)
79 {
81 {
82 cyclesLeft = campcycle;
83 reciever = llAvatarOnSitTarget();
84 displayText();
85 llSetTimerEvent(camptime);
86 }
87 else
88 {
89 if( campmoney<1 )
90 {
91 llInstantMessage(reciever, "You did not stay long enougn to earn any money.");
92 }
93 else
94 {
95 llGiveMoney(reciever,campmoney);
96 }
97
98 reciever=NULL_KEY;
99 campmoney=0;
100 displayText();
102 }
103 }
104 }
105
106
107
108 timer()
109 {
110 campmoney = campmoney+campadd;
111 if( campcycle>0 )
112 {
113 cyclesLeft--;
114 if( cyclesLeft<=0 )
115 {
116 llSay(0,"Standing avatar after " + (string)campcycle + " cycles.");
117 llUnSit(reciever);
118 }
119 }
120 displayText();
121 }
122 }
123
124 state loading
125 {
127 {
128 llSay(0,"Camping pad loading data...");
129 notecardIndex = 0;
130 notecardQuery = llGetNotecardLine(notecardName,notecardIndex++);
131 }
132
133 dataserver(key query_id, string data)
134 {
135 if( notecardQuery == query_id)
136 {
137 // this is a line of our notecard
138 if(data == EOF)
139 {
140 llSay(0,"Data loaded...");
141 state ready;
142
143 } else
144 {
145 if( notecardIndex==1 )
146 {
147 camptime = ((integer)data)*60;
148 }
149 else if( notecardIndex==2 )
150 {
151 campadd = (integer)data;
152 }
153 else if( notecardIndex==3 )
154 {
155 campcycle = (integer)data;
156 }
157
158 notecardQuery = llGetNotecardLine(notecardName,notecardIndex++);
159 }
160 }
161 }
162 }

Camp

Notecard

Category: Camping
By : Encog Dod
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

1 1
2 1
3 2

Back to the Best Free Tools in Second Life and OpenSim.