Difference between revisions of "Dialog Message"
Jump to navigation
Jump to search
(was so annoyed that i forgot to finish the edit ^^;) |
m (lsl code tagging) |
||
Line 11: | Line 11: | ||
|} | |} | ||
< | <lsl> | ||
integer channel = 1000; | |||
string token; | string token; | ||
Line 50: | Line 51: | ||
} | } | ||
} | } | ||
</ | </lsl> | ||
{{LSLC|Examples}} | {{LSLC|Examples}} |
Revision as of 16:38, 30 March 2008
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
A simple script thats lets anyone say a messages over a dialog instead of using llSay or llShout.
Usage: /channel dialog message
• integer | channel | – | channel number the script is listening on | |
• string | message | – | message to display |
<lsl> integer channel = 1000;
string token; string data;
default {
state_entry() { llListen(channel, "", "", ""); } on_rez(integer start_param) { llResetScript(); } sensor(integer num_detected) { if(token == "dialog") { integer i = 0; for(; i < num_detected; ++i) llDialog(llDetectedKey(i), data, [], channel ); } } listen(integer chan, string name, key id, string command) { integer s = llSubStringIndex(command," "); if (~s) { token = llDeleteSubString(command, s, -1); data = llDeleteSubString(command, 0, s); if(token == "dialog") llSensor( "", "", AGENT, 32, PI ); } }
} </lsl>