showroom1 Posted May 25, 2016 Share Posted May 25, 2016 Hi all .I want to read data from a notecard . but I couldn't. can we make a small example ? default{state_entry(){llSay(0, "Hello, Avatar!");}touch_start(integer total_number){llSay(0, "Touched.");}} ------------------------------------------for notecard :(notecard name=msj) hello = what is the message ?avatar = avatar key I don't want anyone else to see the contents of the file command.Thank you very much. Link to comment Share on other sites More sharing options...
Freya Mokusei Posted May 25, 2016 Share Posted May 25, 2016 I don't understand your use of code, but please contain it within a Code block next time. The button looks like </> in the editor. There's already an example of notecard reading in the Wiki:- http://wiki.secondlife.com/wiki/LlGetNotecardLine Hope this helps. Link to comment Share on other sites More sharing options...
showroom1 Posted May 25, 2016 Author Share Posted May 25, 2016 Hi .I'm just learning. I have looked at this example .and I don't understand .I wanted to help her on a small sample.I'm doing a trial for 3 days, but the result is failed.thanks. Link to comment Share on other sites More sharing options...
Freya Mokusei Posted May 25, 2016 Share Posted May 25, 2016 What don't you understand? Have you tried the example in your experiments? It does work. Please try to be more descriptive. I don't have any way to help answer vague responses. Link to comment Share on other sites More sharing options...
showroom1 Posted May 25, 2016 Author Share Posted May 25, 2016 Yes I tried. the samples I tried . but the result is failed . in this example, can you help ? my english is a little bad . I'm sorry. Link to comment Share on other sites More sharing options...
Freya Mokusei Posted May 25, 2016 Share Posted May 25, 2016 You're not giving me enough information to help. I've posted a clear example. The example in the Wiki works, provided:- You have the script placed within an object. You copy it word-for-word, and fully replace any existing code within a script. You have a notecard that contains information in the inventory of the object. Have you done all of these things, when testing the example? What 'failure' do you see? If there's a compilation error message, post it in full along with the code you're trying to use. Inside a code block, like this. I'll try again, but I don't know what sort of help you're expecting. Link to comment Share on other sites More sharing options...
showroom1 Posted May 25, 2016 Author Share Posted May 25, 2016 key kQuery;integer iLine;integer listener; list AvKeys;string Display;integer ON = TRUE;integer i;integer newsum;integer oldsum;integer Dlisten;integer DFlag;key name_q;key online_q;key KeyNow;key user;string status;string owner1 = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";string email_address = "email@yahoo.com"; default { state_entry() { if (llGetInventoryNumber(INVENTORY_NOTECARD) > 0) { iLine = 0; kQuery = llGetNotecardLine(llGetInventoryName(INVENTORY_NOTECARD,0), iLine); } else { llOwnerSay("The UUID notecard is missing from this device."); } } on_rez ( integer startup) { llResetScript(); } changed (integer change) { if (change & CHANGED_INVENTORY) { llResetScript(); } } dataserver(key query_id, string data) { if (query_id == kQuery) { if (data != EOF) { key newkey = (key)llStringTrim(data, STRING_TRIM); if (newkey) { AvKeys += newkey; iLine++; kQuery = llGetNotecardLine(llGetInventoryName(INVENTORY_NOTECARD,0), iLine); } else { llOwnerSay ( "Invalid key in the notecard: \"" + (string) newkey + "\". Initialization cancelled."); } } else { state running; // Finished reading UUIDs from notecard } } } }state running{ state_entry() { llSetColor(<0,1,0>, 5); DFlag = TRUE; llSetTimerEvent(10); } on_rez( integer startup) { llResetScript(); } timer() { llSetText(Display,<1,1,1>,1.0* DFlag); if (oldsum != newsum) // Notify owner of any change in online status { llInstantMessage(llGetOwner(),"Online Status Change \n" + Display); } Display = ""; i = 0; KeyNow = (key)llList2String(AvKeys,0); name_q = llRequestAgentData(KeyNow,DATA_NAME); oldsum = newsum; newsum = 0; } dataserver(key query, string data) { string name; string status; if(name_q == query) { name = data; Display += name; online_q = llRequestAgentData(KeyNow,DATA_ONLINE); } else if (online_q == query) { //status = (string)data; if (data == "0") { status = "Offline"; } else if (data == "1") { status = "Online"; } //llSay(0,(string) status); //newsum += status; Display += " : " +(string) status + "\n"; if ( ++i <= llGetListLength(AvKeys) ) { KeyNow = (key)llList2String(AvKeys,i); name_q = llRequestAgentData(KeyNow,DATA_NAME); } } } touch_start(integer total_number) // Switch timer ON/OFF, activate dialog options { llListenRemove(listener);//A previous user may not have responded. Make sure we don't leak! integer channel = ~(integer)llFrand(1000.0); listener = llListen(channel,"","",""); user = llKey2Name(llDetectedKey(0)); llTextBox(llDetectedKey(0),"Type a message here",channel); } listen (integer channel, string name, key id, string message) { if (status = "Online") { llInstantMessage(owner1, (string) user +" says "+ message); llInstantMessage(owner2, (string) user +" says "+ message); } else if (status = "Offline") { llEmail( email_address, "Email Subject", (string) user + " sent this message \n\n\n"+ message); llEmail( email_address1, "Email Subject", (string) user + " sent this message \n\n\n"+ message); } llListenRemove(listener); } changed (integer change) { if (change & CHANGED_INVENTORY) { llResetScript(); } } } string owner1 = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";string email_address = "email@yahoo.com"; read from the note card. Link to comment Share on other sites More sharing options...
Freya Mokusei Posted May 25, 2016 Share Posted May 25, 2016 Okay - still not in a code block tho.. Should be loading keys from a notecard into AvKeys, which is a list. Does it enter state running? Does it change colour to green? Am I supposed to guess what the error is? What're those three lines at the bottom? Are they part of the script? If so, they shouldn't be there. owner2 isn't defined. emailaddress1 isn't defined. Please respond to, or resolve, all bulletpoints. And provide more information on the error. Link to comment Share on other sites More sharing options...
showroom1 Posted May 25, 2016 Author Share Posted May 25, 2016 I don't know how to get the data in the card note. Link to comment Share on other sites More sharing options...
Freya Mokusei Posted May 25, 2016 Share Posted May 25, 2016 I've re-read. You're having trouble putting data INTO the notecard? The only way to do this is manually, by opening the notecard in your viewer and typing information into the notecard. Remember to save before closing. Again, the notecard should be placed in the same object as the script. If this isn't your problem, and you're having trouble reading FROM the notecard, then please answer my bulletpoints, above. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now