Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Notecard in llDialog popup

Doggie Jigsaw
New Mexico, Arizona 1860s
Join date: 19 Nov 2008
Posts: 52
08-26-2009 21:52
I have been messing around with 2 scripts and have each doing part of what I want, but neither one does all.

I can get either a local say to come up from the notecard upon collision, or I can get a popup to display the text I want in the actual script, but what I was hoping might happen is combining the two scripts so that upon collision- an avatar steps on the "door mat" the script reads the text I want it to say in the popup- from a notecard rather than the script.

I think it would be easier and better to drop the script in and leave it alone, and when I want to change the text I can simply do so in the notecard.

So I have this script and I have a fair idea how this works, tho Im still learning. experimenting with inserting the lldialog lines from the other script, it produced an error, so i'm not sure what needs to be added or altered to do this.

Here is the script I could use for this, as it is;

// From the book:
//
// Scripting Recipes for Second Life
// by Jeff Heaton (Encog Dod in SL)
// ISBN: 160439000X
// Copyright 2007 by Heaton Research, Inc.
//
// This script may be freely copied and modified so long as this header
// remains unmodified.
//
// For more information about this book visit the following web site:
//
// http://www.heatonresearch.com/articles/series/22/

integer index;
key query;

default
{
collision_start(integer num_detected)
{
llSensor("", NULL_KEY, AGENT, 20, PI); //This scans on touch
}
sensor(integer total_number)
{
index = 0;
query = llGetNotecardLine("note",index++);
llSetTimerEvent(10);
}

timer()
{
query = llGetNotecardLine("note",index++);
}

dataserver(key query_id, string data)
{
if (query == query_id)
{
// this is a line of our notecard
if (data == EOF)
{
llSetTimerEvent(0);

} else
{
// increment line count
llSay(0, data);
}
}
}
}

And then here is part of the other script which I changed from a touch_start to collision_start and that aspect does what I want. The llDialog text I have in here I'd rather have in a notecard;


collision_start(integer num_detected)
{
llSensor("", NULL_KEY, AGENT, 20, PI); //This scans on touch
}
sensor(integer total_number)
{
integer current_agent;
for (current_agent = 0; current_agent < total_number; current_agent++) llDialog(llDetectedKey(current_agent), "Please WAIT for the signs to rez as they display the rules and what you need to know BEFORE going to the sim!", ["I Agree"], -12345);
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
08-27-2009 00:23
change the llSay in the data server to save the data to a global variable, then reference the global variable for your dialog text

CODE

//-- insert in globals
string gStrTxt;

//-- instead of your say
gStrTxt += "\n" + data;

//-- get rid of the sensor line, collision gives you all the info you need, replace with this
while (num_detected){
llDialog( llDetectedOwner( --num_detected ), gStrTxt, [], -12345);
}
//-- yes an empty button set works fine, and will display a default "ok" button

//-- and delete the sensor event
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Doggie Jigsaw
New Mexico, Arizona 1860s
Join date: 19 Nov 2008
Posts: 52
08-27-2009 10:51
TY void, I will try messign with that tonightwhen I get home from work and see if I can get it to work.
I kind of thought that sensor line could go away, but I wasn't sure what wasn't needed after changing it from touch to collision, and not knowing one way or the other I left it.