|
Amiz Munro
Registered User
Join date: 8 Jul 2008
Posts: 54
|
12-09-2008 04:50
I have this script and it alll most works just like I want it. When I put it into a prim and touch it it works fine, but if I tuoch the prim again to start the script again it doesnt work. I have to reset the script manually how or where do I add a reset in the script to run each time I touch the prim heres the script /php key kQuery; integer pause = 5; // delay between lines integer iLine = 0; default { touch_start(integer num) // touch to start reading notecard { llWhisper(1, "Reading notecard..."  ; kQuery = llGetNotecardLine("notecard", iLine); // "My Notecard" is default change to what you like } dataserver(key query_id, string data) { if (query_id == kQuery) { if (data == EOF) { llWhisper(1, "No more lines in notecard, read " + (string)iLine + " lines."  ; // omit this is feel like it } else { llSay(0,data); llSleep(pause); iLine++; kQuery = llGetNotecardLine("notecard", iLine); // change "My Notecard" to what notecard you have like above } } } } /php Thanks for looking.
|
|
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
|
12-09-2008 05:31
Your variable: iLine is not reset to zero. Do it as the first thing in the touch event and all will work as requested 
_____________________
From Studio Dora
|
|
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
|
12-09-2008 06:52
If you really want to reset the script each time you touch, consider this: key kQuery; integer pause = 5; // delay between lines integer iLine = 0; default { state_entry() { llWhisper(1, "Reading notecard..."); kQuery = llGetNotecardLine("notecard", iLine); // "My Notecard" is default change to what you like }
touch_start(integer num) // touch to start reading notecard { llResetScript(); }
dataserver(key query_id, string data) { if (query_id == kQuery) { if (data == EOF) { llWhisper(1, "No more lines in notecard, read " + (string)iLine + " lines."); // omit this is feel like it } else { llSay(0,data); llSleep(pause); iLine++; kQuery = llGetNotecardLine("notecard", iLine); // change "My Notecard" to what notecard you have like above } } } }
_____________________
From Studio Dora
|
|
Amiz Munro
Registered User
Join date: 8 Jul 2008
Posts: 54
|
12-09-2008 15:27
Ah! I see where I messed up, thank you so very much! It works like a charm! I learned something in the process too!
|