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
Email Basic_Emailer_Script  

Basic_Emailer_Script

Basic E-mailer Script.lsl

Category: Email
By : Doc Nerd
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Basic_Emailer_Script
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Basic_Emailer_Script_1.lsl
1
2 //...........One Way Email Terminal..........
3 //.......Originally written by Doc Nerd......
4 // This Script is distributed under the terms
5 // of the modified BSD license, reproduced at
6 // the end of the script. The license and
7 // acknowledgments listed must be included if
8 // this script is redistributed in a
9 // non-readable or non-modifiable form.
10
11
12 //..........Variable Block..........
13 key senderKey;
14 string senderName;
15 string eMail;
16 string subject;
17 string bodyText;
18 list sendButtons = ["Yes", "No"];
19 list writeButtons;
20 string removeButton;
21 integer i;
22
23
24 //..........Modules Block..........
25
26 //..........Modules for writing each part of email..........
27 writeAddress()
28 {
29 llListen(0, "", senderKey, ""); //Listen to what the user says.
30 llSay(0, "Please say the address of whom you are sending your email."); //Tell them what to say.
31 llSetTimerEvent(30); //Give them 30 seconds to say it.
32 }
33
34 writeSubject()
35 {
36 llListen(0, "", senderKey, ""); //Listen to what the user says.
37 llSay(0, "Please say the subject of your email."); //Tell them what to say.
38 llSetTimerEvent(30); //Give them 30 seconds to say it.
39 }
40
41 writeBody()
42 {
43 llListen(0, "", senderKey, ""); //Listen to what the user says.
44 llSay(0, "Please say the message you would like to send."); //Tell them what to say.
45 llSetTimerEvent(120); //Give them 120 seconds (2 minutes) to say it.
46 }
47
48
49 //..........Modules to remove buttons already used in llDialog menu..........
50 removeAddress()
51 {
52 i = llListFindList(writeButtons, ["Address"]); //Find "Address" button in list.
53 writeButtons = llDeleteSubList(writeButtons, i, i); //Remove it where it's found.
54 }
55
56 removeSubject()
57 {
58 i = llListFindList(writeButtons, ["Subject"]); //Find "Subject" button in list.
59 writeButtons = llDeleteSubList(writeButtons, i, i); //Remove it where it's found.
60
61 }
62
63 removeMessage()
64 {
65 i = llListFindList(writeButtons, ["Message"]); //Find "Message" button in list.
66 writeButtons = llDeleteSubList(writeButtons, i, i); //Remove it where it's found.
67 }
68
69
70 //..........Running script block..........
71 default
72 {
74 {
75 llSetObjectName("Nerd Gadgets Emailer 100"); //Makes sure the object is called the Nerd Gadgets Emailer 100.
76 writeButtons = ["Address", "Subject", "Message"]; //Sets the llDialog buttons.
77 llListen(67895, "", senderKey, "Yes"); //Activate listeners.
78 llListen(67895, "", senderKey, "No");
79 }
80
81 touch_start(integer total_number)
82 {
83 senderKey = llDetectedKey(0); //Detects who's touching it, to get a raw key.
84 senderName = llKey2Name(llDetectedKey(0)); //Detects who's touching it, to get a name.
85 llDialog(senderKey, "Greetings " + senderName + ", would you like to send an email?", sendButtons, 67895); //Do you like me? Y/N
86 }
87
88 listen(integer channel, string name, key id, string message)
89 {
90 if(message == "Yes") //Starts email writing process.
91 {
92 llSay(0, "Currently being used by " + senderName + "."); //Tells area who's using terminal.
93 state emailer;
94 }
95 if(message == "No") //Thank you, come again.
96 {
97 llSay(0, "Thank you " + senderName + ", for using the " + llGetObjectName());
98 }
99 }
100 }
101
102 state emailer
103 {
105 {
106 if(writeButtons == []) //Check to see if there's anything left to write in the email.
107 {
108 state sendMail; //If not, move to sending module.
109 }
110 llListen(67895, "", senderKey, "Address"); //Activate listeners.
111 llListen(67895, "", senderKey, "Subject");
112 llListen(67895, "", senderKey, "Message");
113 llSetTimerEvent(30); //Gives user 30 seconds to choose a part to write...
114 llSay(0, "You have 30 seconds to choose."); //Informs user they have 30 seconds to choose.
115 llSetText("In use, please wait.", <255,0,0>, .1); //Gives visual cue to others that no one else can use it right now.
116 llDialog(senderKey, "What part of your message would you like to write?", writeButtons, 67895); //Selection button GUI.
117 }
118
119 listen(integer channgel, string name, key id, string message)
120 {
121 if(message == "Address") //Select "Address" button.
122 {
123 state addressWrite; //Enter address writing state.
124 }
125 else if(message == "Subject") //Select "Subject" button.
126 {
127 state subjectWrite; //Enter subject writing state.
128 }
129 else if(message == "Message") //Select "Message" button.
130 {
131 state messageWrite; //SEnter message writing state.
132 }
133 }
134
135 timer() //After 30 seconds are up, time out, and return to default state.
136 {
138 llSay(0, "User has failed to select option in time. Unit is now available for use or retry.");
139 llSetText("",<0,0,0>, 0); //Removes floating text.
140 state default;
141 }
142
143 }
144
145 state addressWrite
146 {
148 {
149 writeAddress(); //Start address writing module.
150 }
151
152 listen(integer channel, string name, key id, string message)
153 {
154 eMail = message; //Save message user said.
155 removeButton = "Address"; //Set variable for button removal.
156 state remainButton; //Enter button removal process state.
157 }
158
159 timer() //After 30 seconds are up, time out, and return to selection state.
160 {
162 llSay(0, "User has failed to enter information quickly enough. Please try again.");
163 state emailer;
164 }
165 }
166
167 state subjectWrite
168 {
170 {
171 writeSubject(); //Start subject writing module.
172 }
173
174 listen(integer channel, string name, key id, string message)
175 {
176 subject = message; //Save message user said.
177 removeButton = "Subject"; //Set variable for button removal.
178 state remainButton; //Enter button removal process state.
179 }
180
181 timer() //After 30 seconds are up, time out, and return to selection state.
182 {
184 llSay(0, "User has failed to enter information quickly enough. Please try again.");
185 state emailer;
186 }
187 }
188
189 state messageWrite
190 {
192 {
193 writeBody(); //Start message writing module.
194 }
195
196 listen(integer channel, string name, key id, string message)
197 {
198 bodyText = message; //Save what the user said.
199 removeButton = "Message"; //Set variable for button removal.
200 state remainButton; //Enter button removal process state.
201 }
202
203 timer() //After 120 seconds (2 minutes) are up, time out, and return to selection state.
204 {
206 llSay(0, "User has failed to enter information quickly enough. Please try again.");
207 state emailer;
208 }
209 }
210
211 state remainButton //Removing buttons from a list SUCKS!
212 {
214 {
215 if(removeButton == "Address") //Removes "Address" button.
216 {
217 removeAddress();
218 state emailer;
219 }
220 else if(removeButton == "Subject") //Removes "Subject" button.
221 {
222 removeSubject();
223 state emailer;
224 }
225 else if(removeButton == "Message") //Removes "Message" button.
226 {
227 removeMessage();
228 state emailer;
229 }
230 }
231 }
232
233 state sendMail
234 {
236 {
237 llListen(67895, "", senderKey, "Yes"); //Starts listeners.
238 llListen(67895, "", senderKey, "No");
239 llSay(0, "Your email reads as the followed:"); //Spews out the actual email message.
240 llSay(0, eMail);
241 llSay(0, subject);
242 llSay(0, bodyText);
243 llDialog(senderKey, "Do you wish to send this message?", sendButtons, 67895); //Do you like me? Y/N
244 }
245
246 listen(integer channel, string name, key id, string message)
247 {
248 if(message == "Yes") //You like me! You really like me!
249 {
250 llSay(0, "I hope you don't mind " + senderName + ", but I will have to assume your name for a moment to send this email."); //Tell user the terminal will change it's name for proper "From" headings in inbox.
251 llSay(0, "Your email will be sent in 20 seconds."); //Tells user email will be sent in 20 seconds (delay of llEmail function call to script).
252 llSay(0, "Thank you " + senderName + ", for using the " + llGetObjectName()); //Thank you, come again.
253 llSetText("", <0,0,0>, 0); //Removes "busy signal".
254 llSetObjectName(senderName); //Change to user's name.
255 llEmail(eMail, subject, bodyText); //Send that damn thing already!
256 state default; //Return to normal.
257 }
258 else if(message == "No") //You don't like me? *emo tear*
259 {
260 llSay(0, "Thank you " + senderName + ", for using the " + llGetObjectName()); //Thank you, come again.
261 llSetText("", <0,0,0>, 0); //Removes "busy signal".
262 state default; //Return to normal.
263 }
264 }
265 }
266
267
268 //Copyright (c) 2005, Doc Nerd & player
269 //All rights reserved.
270 //
271 //Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
272 //
273 // * Redistributions in modifiable form must retain the above copyright notice, this list of conditions and the following disclaimer.
274 // * Redistributions in non-modifiable form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
275 // * Neither the name of Doc Nerd nor his player may be used to endorse or promote products derived from this software without specific prior written permission.
276 //
277 // END //

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