Jump to content

Reading notecard and logging into public chat


ronwald Helendale
 Share

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

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

Recommended Posts

Hi everyone

I have a small issue when reading a notecard and logging it's contents into public chat

Situation:

I have a notecard in my object's root prim containing two lines and I'm using a slightly adapted bit of code that can be found on the LSL wiki.

Problem:

I want the contents of the notecard to be displayed in the state_entry() or attach() method right after reading the notecard.

The problem is when I want to log the contents of the variables that I assigned data to in the dataserver() method onto public chat, I get blanks. I'm assuming the dataserver() method is some kind of asynchronous method because the notecard is read without issues (I checked this by both  ogging the variables straight from the dataserver() method as well as from the touch_start() method).

 

Any idea's on how to do this in a clean way?,

 

If there is anything else you guys need let me know, I can post the script's contents in this thread if necessary.

Thank in advance and I hope to hear from you fellow coders ?

 

Edited by ronwald Helendale
Link to comment
Share on other sites

The only thing you can do is to initiate the reading of the notecard from your state_entry() or attach() and then call a method, e.g. DataserverCompleted(), when the dataserver has finished dealing with the contents.  Just put everything else you wanted to do in your state_entry() or attach() into DataserverCompleted().

Edited by Gabriele Graves
corrections.
Link to comment
Share on other sites

10 minutes ago, ronwald Helendale said:

I'm assuming the dataserver() method is some kind of asynchronous method

The technical term is event, not method. Events are raised in response to things happening. But you are correct, the dataserver event is asynchronous. Once you call a method that requests data from the server (eg. reading notecard contents), nothing will happen immediately and the responses might arrive out-of-order.

As for "doing this cleanly," one way is to have a list as a global variable and add each line to it until you get EOF. Then llDumpList2String to get it into chat.

Link to comment
Share on other sites

Thanks to you too Wulfie, I was already using a global variable to catch the notecards outputs ?

 

We can only wish for the time when LSL gets some objects with subclassign and delegates and all that good stuff lol

This topic is solved (rather quickly thanks to both of you) and may be close if nobody objects ^^

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2042 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...