These forums are CLOSED. Please visit the new forums HERE
Reading lines on a notecard when conditions met? |
|
Senuka Harbinger
A-Life, one bit at a time
![]() Join date: 24 Oct 2005
Posts: 491
|
11-14-2005 21:40
I've been pouring over the wiki and can't seem to figure out how to call a dataserver function when a certain set of conditions are met. The conditions for making that call are calculated in a timer function, and I can't seem to call the dataserver function within the timer event, so my intuition on how to go about assembling it fails me.
|
Cid Jacobs
Theoretical Meteorologist
![]() Join date: 18 Jul 2004
Posts: 4,304
|
11-14-2005 23:54
Sounds like you may be looking for if-else statements . Hope that helps, good luck.
![]() _____________________
|
Ben Bacon
Registered User
Join date: 14 Jul 2005
Posts: 809
|
11-15-2005 03:46
and I can't seem to call the dataserver function within the timer event, |
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
|
11-15-2005 05:04
You may have to transfer code from the timer event into the dataserver event, and store any variables globally so the dataserver has access to them. As ALL the code in a timer will execute BEFORE the dataserver event is called. e.g -
CODE // State and global variables up here (line and lineNo are global) What you'd have to do is something like this: CODE // State and global variables up here (lineNo is a global) This example would request a new notecard line every time the timer comes up (e.g every 10 seconds) and do something to it depending one what that line contains. So if the line is 1 and it reads "foo" then something happens. In the first example the dataserver assigns the value to line, but since the event isn't called until AFTER the timer is finished, the value of data won't be assigned to line until it's time for the next attempt, at which point we're no longer interested in line 1. |
Gaz Hornpipe
Registered User
Join date: 29 Sep 2005
Posts: 36
|
11-15-2005 09:07
The big problem when working with the dataserver is that it works independently from your script.. that is, you can't rely on it returning the information, in this case a notecard line, within the same timeframe each and every time. If you asked for the name of the object with llGetObjectName(), you would have the return of the information immediately before the next line of code. If you have llGetNotecardLine(), you won't get the return of the notecard line immediate before the next line of code, as the script will continue to run without waiting for the dataserver event.
Currently there is no real way for a script to pause/wait for the dataserver event to trigger before continuing, so you have to basically do what the last person said. CODE string gCard = "note"; Basically you reach a certain point in the script and then you have to wait for input.. except that instead of waiting for input from the user, you are waiting or input from another external source: the dataserver. If you only want to read a single notecard line and you know the line number of the notecard to read, then you can simplify the dataserver event.. CODE timer() |
Senuka Harbinger
A-Life, one bit at a time
![]() Join date: 24 Oct 2005
Posts: 491
|
11-15-2005 09:19
Thanks for the help, I managed to get some help in game as well to get what I need finally
here's the code so far (nowhere close to finished for the final product) CODE
|