Difference between revisions of "User:Luisa Bourgoin/current projects/gposnp"
Line 206: | Line 206: | ||
touch_start(integer total_number) | touch_start(integer total_number) | ||
{ | { | ||
if | if(! access_public) if (llListFindList(access_names, [llDetectedName(0)]) < 0) {return;} | ||
if(running || running == SUSPENDED) { | if(running || running == SUSPENDED) { | ||
if(! internal_part) { | if(! internal_part) { | ||
Line 229: | Line 229: | ||
listen(integer channel, string name, key id, string data) | listen(integer channel, string name, key id, string data) | ||
{ | { | ||
if | if(! access_public) if(llListFindList(access_names, [name]) < 0) {return;} | ||
list instructions = llCSV2List(data); //split recieved message | list instructions = llCSV2List(data); //split recieved message |
Revision as of 17:15, 25 April 2010
GPOSNP Project
here you will find all things GPOSNP, like current release, locations for additional materials located inworld, and of course the official instructions documented
Next class will be at ICE, Wednesday the 15th Mai of 2010
The instruction keywords
the controller box understands reset, start, pause and continue commands from currently active chat channel, which can be unreachable from chatbar. a click onto a running box will stop the program.
the color of the box can be
- green for startable, that means not currently running
- yellow for program is running, but currently pausing. click does continue
- red for emergency stopable by a click, meaning things are running at the moment
the possible keywords for program notecards are, as implemented so far:
- channel
- channel, chatchannel
- switches all communications into chatchannel
- timing
- timing, timing
- the default execution timing of instructions will be set to timing seconds. fractions of seconds are allowed
- delay
- delay, seconds
- sets execution to sleeping some seconds
- display
- display, text
- hoovertext text above controller box
- debug
- debug
- hoovertexting currently executed instruction above controller box. used with slow default timing, this can be very helpfull for observing the activity going on
- pause
- pause
- will set controller into idling, again. this consumes as much power as beeing switched off. it's still listening onto chat commands, on last used channel only. external controller prims can use "continue, controllername" to continue with paused program
- chat
- chat, text
- chats some text
- counter
- counter, number
- initializes the loop counter with number
- countdown
- countdown
- jumps back onto last counter, number definition if the counter still isn't empty
- restart
- 'restart
- restartint the program
- authorize
- authorize, name
- adds authorize to the list of people to listen to, or accepting their clicks
- public access
- public access
- sets controller box into public mode, without any user restrictions
- volume
- volume, number
- the controller can chirp some noised, the volume is adjusted by this call onto number percent
- playsound
- playsound, sound
- plays sound which can be any soundfile dropped inside the box
Controller source code
Current release 65360 from 4/23/2010
<lsl> // GPOSNP Project - 'general purpose open source notecarded programming' // // initiated by Luisa Bourgoin 7/2008 for useage inside TUi NEO class // fair use only !! this has been created for educational use initially, respect it's origins // you are free to: // * enhance this code, as long as you publish your additions // * use, for builts (even for sale) but keeping this program piece editable // * combine with listener/recieving interactive parts, even closed source ones
// Todo: fix this stuff, and get a new name for it!!1!
// add soundfiles preloading? could be done by helper script
// caching notes inside memory! getting rid of dataserver events during showtime. Maybe
// llLinkeMessage() connected program storage script?
// ...preparsing notes.
// ...more conditional branching, maybe nameable registers
// release 65360 (push on update)
//preferences values: integer broadcast_channel = 0; integer listener; integer internal_part = FALSE;
integer running = FALSE; integer SUSPENDED = -2; float timing_speed = 2.0;
integer access_public = FALSE; list access_names;
string confNoteName; integer notecard_line; integer notecard_lastline; key notecard_lastline_quid; key notecard_request;
integer counter = 0; integer counter_line = 0;
float volume = 1.0; //for sounds integer debug = FALSE;
// if there is anything as in central intelligence, this implements it ... eventually process(string data) {
list instructions = llCSV2List(data); //split recieved message string command = llList2String(instructions,0); if(debug) llSetText(data, <1,1,1>, 0.5); // parse some instructions if( llGetSubString(command, 0, 0) == "#" || llGetSubString(command, 0, 1) == "////") { //commented out } else if( command == "display") { llSetText(llGetSubString(data,llStringLength(command)+1,-1), <1,1,1>, 0.5); } else if( command == "debug") { debug = TRUE; //to debug or not debug, that is the question! (shaking knees) } else if( command == "delay") { llSleep(llList2Float(instructions,1)); } else if( command == "timing") { timing_speed = llList2Float(instructions,1); } else if(command == "pause") { if(! internal_part) llSetColor(<1,1,0>, ALL_SIDES); running = SUSPENDED; } else if( command == "channel") { broadcast_channel = llList2Integer(instructions,1); llListenRemove(listener); listener = llListen(broadcast_channel,"","",""); } else if( command == "chat") { llSay(0, llGetSubString(data,llStringLength(command)+1,-1)); } else if( command == "counter") { counter = llList2Integer(instructions,1); counter_line = notecard_line; } else if( command == "countdown") { if(counter-- > 1) { notecard_line = counter_line; } } else if( command == "restart") { notecard_line = 1; } else if( command == "authorize") { access_names += llList2String(instructions,1); } else if( command == "public access") { access_public = TRUE; } else if( command == "volume") { volume = llList2Float(instructions,1); } else if( command == "playsound") { llPlaySound(llList2String(instructions,1), volume); //llPreloadSound(llList2String(instructions,1)); } else { llSleep(timing_speed); if(! internal_part) llShout(broadcast_channel , data); // or llShout() else llMessageLinked(1, broadcast_channel, data, NULL_KEY); // or LINK_SET }
}
default {
state_entry() { llSetText("", <1,1,1>, 0.5); if(! internal_part) llSetColor(<0,1,0>, ALL_SIDES); access_names = [] + llKey2Name(llGetOwner()); listener = llListen(broadcast_channel,"","",""); confNoteName = llGetInventoryName( INVENTORY_NOTECARD ,0 ); notecard_lastline_quid = llGetNumberOfNotecardLines(confNoteName); }
on_rez(integer start_params) { llResetScript(); } touch_start(integer total_number) { if(! access_public) if (llListFindList(access_names, [llDetectedName(0)]) < 0) {return;} if(running || running == SUSPENDED) { if(! internal_part) { llWhisper(0, "stopping "+confNoteName); llSetColor(<0,1,0>, ALL_SIDES); } running = FALSE; } else { if(! internal_part) { llWhisper(0, "running program "+confNoteName); llSetColor(<1,0,0>, ALL_SIDES); } running = TRUE; debug = FALSE; notecard_line = 1; notecard_request = llGetNotecardLine( confNoteName, notecard_line++ - 1 ); // request line notecard_lastline_quid = llGetNumberOfNotecardLines(confNoteName); // refresh! otherwise, editing those would kill your patience :) } } listen(integer channel, string name, key id, string data) { if(! access_public) if(llListFindList(access_names, [name]) < 0) {return;} list instructions = llCSV2List(data); //split recieved message string command = llList2String(instructions,0); string target = llList2String(instructions,1);
if(target == llGetObjectName()) { if(command == "reset") { llResetScript(); } else if(command == "start") { if(! internal_part) llSetColor(<1,0,0>, ALL_SIDES); running = TRUE; debug = FALSE; notecard_line = 1; notecard_request = llGetNotecardLine( confNoteName, notecard_line++ - 1 ); // request line notecard_lastline_quid = llGetNumberOfNotecardLines(confNoteName); // refresh! } else if(command == "pause") { if(! internal_part) llSetColor(<1,1,0>, ALL_SIDES); running = SUSPENDED; } else if(command == "continue" && running == SUSPENDED) { if(! internal_part) llSetColor(<1,0,0>, ALL_SIDES); running = TRUE; notecard_request = llGetNotecardLine( confNoteName, notecard_line++ - 1 ); // request line } } } dataserver(key query_id, string data) { if(query_id == notecard_request && data != EOF && running == TRUE) { process(data); if((notecard_line -1) >= notecard_lastline) { running = FALSE; if(! internal_part) llSetColor(<0,1,0>, ALL_SIDES); } if(running == TRUE) notecard_request = llGetNotecardLine( confNoteName, notecard_line++ - 1 ); } else if(query_id == notecard_lastline_quid) { notecard_lastline = (integer)data; //inconsequent! } }
} //eof </lsl>
additional scripts, slides and notes can be obtained here: ICE classes board🖈