Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

read notecard stored in "primary" prim

Tadao Nordenskiold
Registered User
Join date: 9 May 2009
Posts: 37
09-23-2009 07:48
Hello!

I don't know if what I want is possible, but hopefully someone can help me towards the right direction.

I have an object consisting of 5 prims.
4 "buttons" attached to one prim.

I would like to store a notecard in the "primary" prim, and when klicking the buttons, the scripts in those buttons should read from the notecard.

The notecard has 2 lines with username and password, and the buttons are different HttpRequest functions athat all needs the same username and password.

The only reason I want something like this, is because one of the buttons is a "change password" button, and it gets too complicated if users should update one notecard in each prim. (That is the only way I know of doing it, having one notecard/notecard reader for each button).

I hope someone can come to my rescue and tell me what to do. :)
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
09-23-2009 08:28
you can read a notecard by referencing it's uuid, a notecard uuid changes each time it is saved, so you could pass a link message to the other prims with the new uuid of the notecard after saving it. i did try to run a test before that would keep track of the notecard uuids in the contents, and if it got an inventory change event, it would run through a loop checking the notecard uuids to see which one changed, didn't work out though, and i'm not sure why

/54/05/336589/1.html#post2540408

ETA: looking over that post again, i think i got the llListFindList test backwards, it looks like it's looking for the whole list of notecards within name after it's been cast to a list, i will try it again later and see what happens
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
09-23-2009 08:39
If the buttons all do the same thing, it's waaaaay more efficient to just put one script in the root prim then use things like llDetectedLink/llGetLinkName to figure out which button was pressed. Just make sure to name the button prims with something the main script will understand.
_____________________
Sick of sims locking up every time somebody TPs in? Vote for SVC-3895!!!
- Go here: https://jira.secondlife.com/browse/SVC-3895
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
09-23-2009 11:23
From: Sindy Tsure
If the buttons all do the same thing, it's waaaaay more efficient to just put one script in the root prim then use things like llDetectedLink/llGetLinkName to figure out which button was pressed. Just make sure to name the button prims with something the main script will understand.


ah, that too, lol, but if anyone's interested, i did find the 2 mistakes on the script i posted on the other thread, edited the post with the correct one
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Tadao Nordenskiold
Registered User
Join date: 9 May 2009
Posts: 37
09-23-2009 16:04
Well, the 4 buttons do the same thing, except for what it sends in the httprequest...
Each http request has it's own set of variables (except for the username and password that is stored in the notecard)
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
09-23-2009 16:09
Unless you have a reason not to, I'd do one script in the root prim then. Something like...

CODE


DoHttpRequest (...)
{
}

default
{
touch_start(integer count)
{
integer i;
for (i = 0; i < count; i++)
{
string button = llGetLinkName (llDetectedLinkNumber(i));

if (button == "explode")
{
DoHttpRequest (...);
}
else if (button == "implode")
{
DoHttpRequest (...);
}
else if (button = "don't push!")
{
DoHttpRequest (...);
}
}
}
}
_____________________
Sick of sims locking up every time somebody TPs in? Vote for SVC-3895!!!
- Go here: https://jira.secondlife.com/browse/SVC-3895
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Tadao Nordenskiold
Registered User
Join date: 9 May 2009
Posts: 37
09-23-2009 17:01
Hmm.. It never occured to me that I could use httprequests in if statements.
I was told one "Only one httprequest/script", and I think my mind stuck at that so much that I never thought of using them in if statements.. but that is quite obvious to do... :p

Thanks a lot! :)

Edit:

Hmm.. as I have have never used this method before.. could you just tell me what to use in the touch_start states of the buttons?

Edit2:

I just saw this now.. the example script Sindy used, suggest that the root prim is to be touched.
As this is going to be a HUD, with 4 buttons, the root prim will never be touched.

Maybe a better approach is to use Link_Messages. I just read about it before I saw Sindy's post.
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
09-23-2009 17:30
Nooo.... If you have an object with multiple prims and the child prims don't have scripts that deal with touch events, the child prims will send the touch events up to the root prim. That's what the llDetectedLink stuff is for - to figure out which child/button prim was touched.
_____________________
Sick of sims locking up every time somebody TPs in? Vote for SVC-3895!!!
- Go here: https://jira.secondlife.com/browse/SVC-3895
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left