Jump to content

data read from notecards


showroom1
 Share

You are about to reply to a thread that has been inactive for 2864 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

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

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

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_idstring data
    {
        if (
query_id == kQuery
        {   
            if (
data != EOF
            {
                
key newkey = (key)llStringTrim(dataSTRING_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_rezinteger startup)
    {
        
llResetScript();
    }
    
    
timer()
    {
        
llSetText(Display,<1,1,1>,1.0DFlag);
        if (
oldsum != newsum)  // Notify owner of any change in online status
        
{
            
llInstantMessage(llGetOwner(),"Online Status Change \n" Display);
        }
        
Display "";
        
0;
        
KeyNow = (key)llList2String(AvKeys,0);
        
name_q llRequestAgentData(KeyNow,DATA_NAME);
        
oldsum newsum;
        
newsum 0;
    }
    
    
dataserver(key querystring 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 ( ++
<= 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 channelstring namekey idstring message)
    {
        if (
status "Online")
        {
            
llInstantMessage(owner1, (string) user +" says "message);
            
llInstantMessage(owner2, (string) user +" says "message);
        }
        else if (
status "Offline")
        {
           
llEmailemail_address"Email Subject", (string) user " sent this message \n\n\n"message);
        
llEmailemail_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

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

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

You are about to reply to a thread that has been inactive for 2864 days.

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
 Share

×
×
  • Create New...