Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

URL Loader

Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
04-06-2005 11:40
I made this to read a notecard called 'bookmarks' so you can click on a prim and it will direct you to the right place. It also uses hover text to show what it's looking at.

CODE

string card="bookmarks";
integer i=0;
integer pointer=0;
list URLs;
list Hover;
key owner;
integer listenID;

default
{
state_entry()
{
llSetText("Loading bookmarks", <1,1,1>, 1.0);
llGetNotecardLine(card, i);
owner=llGetOwner();
}
touch_start(integer times)
{
key who=llDetectedKey(0);
if(who==owner)
{
llDialog(owner, "Open URL or select new target?", ["Open", "Prev", "Next"], 1001);
llListenRemove(listenID);
listenID=llListen(1001, "", owner, "");
} else {
llLoadURL(llDetectedKey(0), "Load "+llList2String(Hover, pointer), llList2String(URLs, pointer));
}
}
dataserver(key query, string data)
{
if(data!=EOF)
{
list temp=llCSV2List(data);
Hover+=llList2String(temp, 0);
URLs+=llList2String(temp, 1);
i++;
llGetNotecardLine(card, i);
} else {
llSetText(llList2String(Hover, pointer), <1,1,1>, 1.0);
}
}
listen(integer channel, string name, key ID, string message)
{
llSetTimerEvent(60);
if(message=="Open")
{
llLoadURL(llGetOwner(), "Load "+llList2String(Hover, pointer), llList2String(URLs, pointer));
} else if(message=="Prev")
{
pointer++;
if(pointer==llGetListLength(Hover))
{
pointer=0;
}
} else if(message=="Next")
{
pointer--;
if(pointer<0)
{
pointer=llGetListLength(Hover);
pointer--;
}
}
llSetText(llList2String(Hover, pointer), <1,1,1>, 1.0);
llListenRemove(listenID);
}
changed(integer change)
{
if(change & CHANGED_INVENTORY)
{
llResetScript();
}
}
timer()
{
llListenRemove(listenID);
}
}


You need a notecard with the description then the full URL, separated by commas, one per line in there too, that's it!
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Discussion
04-08-2005 13:15
/54/1b/42051/1.html
_____________________
i've got nothing. ;)
Dreams Lightcloud
Skirt Flirt
Join date: 6 May 2004
Posts: 140
11-12-2005 18:56
This script crashes me everytime :(
_____________________
Aree Lulibub
Registered User
Join date: 21 Jan 2007
Posts: 198
06-11-2007 11:06
From: Eloise Pasteur
I made this to read a notecard called 'bookmarks' so you can click on a prim and it will direct you to the right place. It also uses hover text to show what it's looking at.

CODE

string card="bookmarks";
integer i=0;
integer pointer=0;
list URLs;
list Hover;
key owner;
integer listenID;

default
{
state_entry()
{
llSetText("Loading bookmarks", <1,1,1>, 1.0);
llGetNotecardLine(card, i);
owner=llGetOwner();
}
touch_start(integer times)
{
key who=llDetectedKey(0);
if(who==owner)
{
llDialog(owner, "Open URL or select new target?", ["Open", "Prev", "Next"], 1001);
llListenRemove(listenID);
listenID=llListen(1001, "", owner, "");
} else {
llLoadURL(llDetectedKey(0), "Load "+llList2String(Hover, pointer), llList2String(URLs, pointer));
}
}
dataserver(key query, string data)
{
if(data!=EOF)
{
list temp=llCSV2List(data);
Hover+=llList2String(temp, 0);
URLs+=llList2String(temp, 1);
i++;
llGetNotecardLine(card, i);
} else {
llSetText(llList2String(Hover, pointer), <1,1,1>, 1.0);
}
}
listen(integer channel, string name, key ID, string message)
{
llSetTimerEvent(60);
if(message=="Open")
{
llLoadURL(llGetOwner(), "Load "+llList2String(Hover, pointer), llList2String(URLs, pointer));
} else if(message=="Prev")
{
pointer++;
if(pointer==llGetListLength(Hover))
{
pointer=0;
}
} else if(message=="Next")
{
pointer--;
if(pointer<0)
{
pointer=llGetListLength(Hover);
pointer--;
}
}
llSetText(llList2String(Hover, pointer), <1,1,1>, 1.0);
llListenRemove(listenID);
}
changed(integer change)
{
if(change & CHANGED_INVENTORY)
{
llResetScript();
}
}
timer()
{
llListenRemove(listenID);
}
}


You need a notecard with the description then the full URL, separated by commas, one per line in there too, that's it!


I tried using this script and got a ";(0, 0) : ERROR : Syntax error" message. Not being a scripter, I have no clue how to fix it. Any suggestions? :)