Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Can two scripts read same notecard?

Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
09-08-2007 11:31
I'm making myself an add-on for a JEVN vendor.

I drop an additional script into the vendor.

I want to have the script read one param from a notecard.

I tried reading from the _config card that comes with it, putting a # in front of the param so the JEVN scripts would ignore it. But ran into problems (will explain in a sec).

I tried making my own config card, and read from that, but ran into same kind of problems.

explanation of problems:

my dataserver stuff is pretty standard:

key AdminRequest;

AdminRequest = llGetNotecardLine(CardName, tI = 0 );

dataserver( key myQuery, string sData ) {

if ( AdminRequest == myQuery ) {
blah blah blah

(1) JEVN scripts seem to read "my" config card too. Hmmmm. Maybe they are set to read *any* and all notecards. I can't do a thing about that, as they are of course non-mod;

(2) Sometimes when I run it, even though I've tested for my query, by doing llSay's I can hear results for what the JEVN script is reading;


(3) At times when that doesn't happen, then what *does* happen i s nothing. Nothing, as in my sData result just comes up blank.

(4) I have tried using llSleep(5) on *my* dataquery, to see if it would work when the JEVN scripts were done their stuff, but that didn't really seem in influence any of the above results, just make me wait longer to see that I hadn't got anywhere :}


I know this is going to end up being real simple one way or another: either it can't be done, or it's real simple.

I have developed other apps where I have two different scripts reading from two different notecards, and they play quite nicely with each other.
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
09-08-2007 11:46
You can read two different notecards...it does play nice.

It sounds like the JEVN vendor is setup to read possibly the first notecard in inventory? Try changing the name of your notecard? Or...maybe it's set to read the last notecard in inventory? If it's set to read ALL notecards in inventory...which the only reason for that would be if JEVN has upgrades that require multiple notecards (not likely)...then you're stuck.
_____________________
--AeonVox--

Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
09-08-2007 11:58
From: Kenn Nilsson
You can read two different notecards...it does play nice.

It sounds like the JEVN vendor is setup to read possibly the first notecard in inventory? Try changing the name of your notecard? Or...maybe it's set to read the last notecard in inventory? If it's set to read ALL notecards in inventory...which the only reason for that would be if JEVN has upgrades that require multiple notecards (not likely)...then you're stuck.


Thanks Kenn.

The JEVN API doesn't give any special info about how to read from their config cards without causing scripts and dataserver events to trip over each other, though I think a friend of the maker has figured it out.

Anyway, I've just now abandoned this, and have figured out another way to get the one parameter I need, so no need to bother anyone, thanks.
Ravanne Sullivan
Pole Dancer Extraordinair
Join date: 10 Dec 2005
Posts: 674
09-08-2007 13:46
From: Chaz Longstaff

AdminRequest = llGetNotecardLine(CardName, tI = 0 );


The t1 = 0 is a problem, the function is expecting an integer not an equation.

AdminRequest = llGetNotecardLine(CardName, 0 );

Is more appropriate to read the first line.

You can also test the first charecter of the line to see if it matches the # and only proceed if it does.

if (llGetSubString(sData,0,0) == "#";)
{
string LineRead = llGetSubString(sData,0,-1);
(do what you want with the retrieved string now in LineRead)
}

needlessly complex for clarity

And I have not had any problems with more than one script using the same config card, I preface each line with a tag that I use to determine what the line is for and let the script decide if it needs it or not.
_____________________
Ravanne's Dance Poles and Animations

Available at my Superstore and Showroom on Insula de Somni
http://slurl.com/secondlife/Insula de Somni/94/194/27/
Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
09-08-2007 13:55
kewl thanks Ravanne will try.

the other way i thought i would do it turned out to be dead end.

the t1 = 0 comes from a sample posted elsewhere in this forum.
Domino Marama
Domino Designs
Join date: 22 Sep 2006
Posts: 1,126
09-08-2007 15:38
From: Ravanne Sullivan
The t1 = 0 is a problem, the function is expecting an integer not an equation.


It's not a problem or an equation, it's an optimised assignment to set the tI variable used for the line counter to 0 while requesting the first line.