Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Notecard to list

Turokhan Legion
Vortech Enterprises CEO
Join date: 22 Jul 2007
Posts: 32
08-17-2008 05:47
I can't fatham this script, i'm trying to read a line from a notecard which this script listens too.

vector map = <10, 10, 22>;
//vector map = msg; //if i use this one it syntax's

default {
state_entry()
{
llListen(-48, "", NULL_KEY, "";);
}
listen(integer x, string name, key id, string msg)
{
if (llGetOwnerKey(id) == llGetOwner())
{
llSay(0,msg); //this gives me the co-ordinates from the notecard i.e <10,10,10>
}
}touch_start(integer sp)
{
llMapDestination("hope isle",map,ZERO_VECTOR);
}
}

What am i missing?
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
08-17-2008 06:02
this line: vector map = msg; //if i use this one it syntax's
can not be executed outside a state i.e you can't define a global variable with another variable.
Otherwise what is it you are trying to do?
The only thing you do not is reading a note card:)
_____________________
From Studio Dora
Turokhan Legion
Vortech Enterprises CEO
Join date: 22 Jul 2007
Posts: 32
08-17-2008 06:12
Notecard contains:

Co-ords=<161, 52, 976>

I have a script in that prim which reads the notecard line <161, 52, 976>

The script then sends a message on channel -48 to another prim

So llSay(0,msg); displays <161, 52, 976> in local chat.

I want the msg to be written into:
llMapDestination("hope isle",<161, 52, 976>,ZERO_VECTOR);

Cheers :)
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
08-17-2008 06:40
Your scripts would have to be something like this. Note I haven't compiled them but they should be fine except for maybe a typo or something. If you want to get the scripts in the correctly formatted (with indentations etc.) form then click "Quote" at the end of my post, and copy/paste the text inside the PHP tags.

This script goes in the prim with the notecard(s), it currently reads the first notecard it finds, processes all lines then stops until its contents change:
CODE
key dataID = NULL_KEY;
string notecard = "";
integer line = 0;

default {
state_entry() {
if (llGetInventoryNumber(INVENTORY_NOTECARD) > 0) {
notecard = llGetInventoryName(INVENTORY_NOTECARD, 0);
dataID = llGetNotecardLine(notecard, i = 0);
}
}

changed(integer x) {
if (x & CHANGED_INVENTORY) llResetScript();
}

dataserver(key id, string data) {
if ((id != dataID) || (data == "EOF")) return;

list parts = llParseString2List((data = "") + data, ["="], []);
if ((parts != []) > 1) {
string key = llToUpper(llList2String(parts, 0));
string value = llList2String((parts = []) + parts, 1);

if (key == "CO-ORDS")
llSay(-48, "COORDS" + value);
}

dataID = llGetNotecardLine(notecard, ++line);
}
}


This script goes in the receiving object. It opens a channel, and if it receives something on that channel from an object with the same owner then it checks if it starts with "COORDS" and sets the co-ordinates accordingly:
CODE
vector coords = ZERO_VECTOR;

default {
state_entry() {
llListen(-48, "", NULL_KEY, "");
}

listen(integer x, string name, key id, string msg) {
if (llGetOwnerKey(id) == llGetOwner()) {
if (llGetSubString(msg, 0, 5) == "COORDS") {
if (llStringLength(msg) >= 13) // Vector needs at least 7 characters (<0,0,0>
coords = (vector)llGetSubString(msg, 6, -1);
}
}
}

touch_start(integer x) {
llMapDestination("hope islie", coords, ZERO_VECTOR);
}
}
_____________________
Computer (Mac Pro):
2 x Quad Core 3.2ghz Xeon
10gb DDR2 800mhz FB-DIMMS
4 x 750gb, 32mb cache hard-drives (RAID-0/striped)
NVidia GeForce 8800GT (512mb)