Jump to content
Sign in to follow this  
sophy7777

trying to add a llreadnotercardline into a listen script

Recommended Posts

i have a script to listen for another object but i want it to send over what info is on the nc, i tried a few diffrent ways but seemed not to work woundered if anyone could advise me to how to add it in rightly. 

the script without any nc reader tried to bed added is

 

integer COMMCHAN = -99424;
string COMMSTRING = "ff254DD!!Fk";
integer listenHandle;


default
{
    state_entry()
    {
        listenHandle = llListen(COMMCHAN, "", NULL_KEY, COMMSTRING);
    }
 
    listen(integer channel, string name, key UUID, string message)
    {
        if (message == COMMSTRING) {
            key vet = llGetOwnerKey(UUID);
            llRegionSayTo(otherobject,0,"INFO YOU WANT TO SEND!");
        }
    }
}

 

and how i tried to add in the nc reader 

 

integer COMMCHAN = -99424;
string COMMSTRING = "ff254DD!!Fk";
integer listenHandle;

key notecardQueryId;
string notecardName = "info";


default
{
    state_entry()
    if (llGetInventoryKey(notecardName) == NULL_KEY)
        {
            llOwnerSay( "Notecard '" + notecardName + "' missing or unwritten");
            return;
        }
        // say("reading notecard named '" + notecardName + "'.");
        notecardQueryId = llGetNotecardLine(notecardName, notecardLine);
    }

{
        listenHandle = llListen(COMMCHAN, "", NULL_KEY, COMMSTRING);
    }
 
    listen(integer channel, string name, key UUID, string message)
    {
        if (message == COMMSTRING) {
            key vet = llGetOwnerKey(UUID);
            llRegionSayTo( ": " + (string) notecardLine + " " + data);
                notecardQueryId = llGetNotecardLine(notecardName, notecardLine);
        }
    }
}

 

 

like i say im pretty new to scripting so may have gone the wrong way bout this >.< any help is aprecated and sorry if ive put this in the wrong category i get confused with them all i think >.< 

Share this post


Link to post
Share on other sites
23 minutes ago, sophy7777 said:

Etc..

You might want to read through these pages :

http://wiki.secondlife.com/wiki/LlGetNotecardLine

http://wiki.secondlife.com/wiki/Category:LSL_Notecard

You need the data server event to pick up what info was read when using llGetNotecardLine, there is an example in the first link I posted that shows you how that is done. 😁

Also, don't worry too much about being new. We were all new at one point and in your position and this forum is here for you to ask questions and get help and progress your learning ^_^

 

  • Like 3

Share this post


Link to post
Share on other sites
1 minute ago, chibiusa Ling said:

You might want to read through these pages :

http://wiki.secondlife.com/wiki/LlGetNotecardLine

http://wiki.secondlife.com/wiki/Category:LSL_Notecard

You need the data server event to pick up what info was read when using llGetNotecardLine, there is an example in the first link I posted that shows you how that is done. 😁

Also, don't worry too much about being new. We were all new at one point and in your position and this forum is here for you to ask questions and get help and progress your learning ^_^

 

i had a lok though them but its lates pronberly just need a break before trying again i think my brain melts away

 

Share this post


Link to post
Share on other sites
1 minute ago, sophy7777 said:

i had a lok though them but its lates pronberly just need a break before trying again i think my brain melts away

 

What does the notecard do. Is it an information object?

Share this post


Link to post
Share on other sites
1 minute ago, steph Arnott said:

What does the notecard do. Is it an information object?

nods just states info that would be medicaly wanted kinda thing 

so name

parents

alergies 

 

Share this post


Link to post
Share on other sites
20 minutes ago, sophy7777 said:

i had a lok though them but its lates pronberly just need a break before trying again i think my brain melts away

Im not 100% sure on what you are wanting your script to do as some things are not making sense but in terms of your script as it stands you are looking to roughly do something like this :

integer COMMCHAN = -99424;
string COMMSTRING = "ff254DD!!Fk";
integer listenHandle;

key notecardQueryId;
string notecardName = "info";
key vet;

default{
    state_entry(){
        if (llGetInventoryKey(notecardName) == NULL_KEY){
            llOwnerSay( "Notecard '" + notecardName + "' missing or unwritten");
        }else{
            listenHandle = llListen(COMMCHAN, "", NULL_KEY, "");
        }
    }
    listen(integer channel, string name, key id, string message){
        if(message==COMMSTRING){
            vet = llGetOwnerKey(UUID);
            notecardQueryId = llGetNotecardLine(notecardName, notecardLine);
        }
    }
    dataserver(key id, string data){
        if(id==notecardQueryID){
            if(data!=EOF){
                //I took a guess here that you wanted to send the info to the current owner of the object using the vet key variable
                llRegionSayTo(vet,": "+(string)notecardLine+" "+data);
                //I also wasn't sure if you wanted to set the notecard line number to the next line but if so you do it like this
                ++notecardLine;
            }
        }
    }
}

This as it stands will not work fully as its missing whatever else it is that you want it to do BUT....you could use it as a reference for how to read a notecard line and send the data in the way you are asking.

Share this post


Link to post
Share on other sites
Just now, steph Arnott said:

You claim to be a coder and yet make even basic mistakes. Odd that.

Says the person more often corrected than right?. Il explain a little better.....il even put it in capitals so you can understand it one word at a time. You ready......THE.....SCRIPT.....WAS....NOT.....MEANT....TO....BE.....PERFECT....AS....IT....WAS....BASED...ON....HER.....CODE....AND....WAS....WRITTEN.....MOSTLY......COPYING....HER.....CODE.....AND....ADDING....ROUGH.....I....REPEAT.....ROUGH....CODE....FOR....WHAT....ELSE....SHE....NEEDED...TO....DO......

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...