Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

barr's elevator script

rathlin Zeno
Registered User
Join date: 28 May 2006
Posts: 12
11-15-2006 19:41
hi - i'm not very experienced with scripts, but i'm receiving syntax errors on lines 22 and 13, when i try to implement the script on this page:
http://www.jeff-barr.com/?p=566

the exact message is:
(22, 13), : ERROR : Syntax error

the script i use is as follows:

integer MIN_HEIGHT = 2;
integer MAX_HEIGHT = 15;

Text(string Message)
{
llSetText(Message, <0, 1, 0>, 1.0);
}

default
{
state_entry()
{
llSitTarget(<0.4,0.0,.35>, ZERO_ROTATION);
llSetTimerEvent(2);
state idle;
}
}

state idle
{
state_entry()
{
Text(”Sit here to read the AWS Blog”);
vector pos = llGetPos();
float GroundHeight = llGround(<0, 0, 0>;);

pos.z = GroundHeight + MIN_HEIGHT;
llSetPos(pos);
}
changed(integer Change)
{
if (Change & CHANGED_LINK)
{
if (llAvatarOnSitTarget() != NULL_KEY)
{
Text(”Welcome aboard!”);
llSleep(3);
state going_up;
}
}
}
}

state going_up { state_entry() { Text(”Going up…”); } timer() { vector pos = llGetPos(); vector motion = <0, 0, 2>; pos += motion; float GroundHeight = llGround(<0, 0, 0>;); if (pos.z < = (GroundHeight + MAX_HEIGHT)) { llSetPos(pos); } else { state going_down; } } changed(integer Change) { if (Change & CHANGED_LINK) { if (llAvatarOnSitTarget() == NULL_KEY) { Text("Thanks for watching!";); llSleep(3); state idle; } } } }

state going_down { state_entry() { Text(”Going down…”); } timer() { vector pos = llGetPos(); vector motion = <0, 0, -2>; pos += motion; float GroundHeight = llGround(<0, 0, 0>;); if (pos.z >= (GroundHeight + MIN_HEIGHT)) { llSetPos(pos); } else { llUnSit(llAvatarOnSitTarget()); state idle; } llSetPos(pos); } changed(integer Change) { if (Change & CHANGED_LINK) { if (llAvatarOnSitTarget() == NULL_KEY) { Text(”Thanks for watching!”); llSleep(3); state idle; } } } }
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-15-2006 19:51
The code is not in a form that is really readable. But problems like this are apparent:

Text(”Sit here to read the AWS Blog”);

You can't just say Text. Are you trying to use llSetText or llSay or llOwnerSay?

Past that point you need to read the sticky at the top of the forum and it will show how to use PHP in and out and need to look at some other scripts to see how we lay them out. But still you have to start learning some where and this is the place:-)
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Llauren Mandelbrot
Twenty-Four Weeks Old.
Join date: 26 Apr 2006
Posts: 665
11-15-2006 20:00
From: Jesse Barnett
The code is not in a form that is really readable.
Agreed.
From: Jesse Barnett
But problems like this are apparent:

Text(”Sit here to read the AWS Blog”);

You can't just say Text. Are you trying to use llSetText or llSay or llOwnerSay?
I`m sorry, Jesse, but Text is a defined function in this script, beginning at line four:
CODE
Text(string Message)
{
llSetText(Message, <0, 1, 0>, 1.0);
}
_____________________
  1. ninjafoo Ng Says:
    November 4th, 2006 at 7:27 am
    We all love secondlife so much and were afraid that the magic will end, nothing this good can ever last…. can it?

Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-15-2006 20:10
OMG thought I had read every page of the wiki. Guess I missed one. Sorry!!!! (ugh oh)
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-15-2006 20:19
Well now I don't feel bad. Wiki doesn't say poop about using "text" in that manner.

per the wiki:
"Text
Obviously, text is used throughout SL's user interface and LSL in script code, but text also appears in notecards and there are certain functions that deal specifically with text:

llSetText
llSetTouchText
llSetSitText

Many functions use string parameters to set user-interface text fields, like names."

Guess I would really need an example or something to understand it can be used.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Llauren Mandelbrot
Twenty-Four Weeks Old.
Join date: 26 Apr 2006
Posts: 665
11-15-2006 20:22
From: Jesse Barnett
OMG thought I had read every page of the wiki. Guess I missed one. Sorry!!!! (ugh oh)
Um, I`m sorry, Jesse?:o:confused: What does this have to do with reading the wiki? The function is defined within the script itself. Line four. I thought I said as much.
_____________________
  1. ninjafoo Ng Says:
    November 4th, 2006 at 7:27 am
    We all love secondlife so much and were afraid that the magic will end, nothing this good can ever last…. can it?

Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-15-2006 20:34
AHHHH(picture a 10 watt lightbulb above my head shining dimly)

I get it, took a while. It is setup as a user defined function. Cool trick, it might come in handy for me sometime. I was thinking only in llFunction terms.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Llauren Mandelbrot
Twenty-Four Weeks Old.
Join date: 26 Apr 2006
Posts: 665
<==< You mean this one? <==<
11-15-2006 20:44
AHHHH(picture a 10 watt lightbulb above my head shining dimly)Ok.

A ten-watt lightbulb. Check.

Your head shining dimly. Check.

[The lightbulb] above [your head shining dimly]. Check

::giggle:::D
I get it, took a while. It is setup as a user defined function. Cool trick, it might come in handy for me sometime. I was thinking only in llFunction terms.No problem. These things happen to all of us from time to time.:)

:o...now if only I could find rathlin`s problem as easily as I found the basis of your misunderstanding...
_____________________
  1. ninjafoo Ng Says:
    November 4th, 2006 at 7:27 am
    We all love secondlife so much and were afraid that the magic will end, nothing this good can ever last…. can it?

Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-15-2006 21:01
Here you go rathlin. It was the font he was using on that webpage. SL couldn't read the quotation marks and the periods correctly.

CODE

integer MIN_HEIGHT = 2;
integer MAX_HEIGHT = 15;

Text(string Message)
{
llSetText(Message, <0, 1, 0>, 1.0);
}

default
{
state_entry()
{
llSitTarget(<0.4,0.0,.35>, ZERO_ROTATION);
llSetTimerEvent(2);
state idle;
}
}

state idle
{
state_entry()
{
Text("Sit here to read the AWS Blog");
vector pos = llGetPos();
float GroundHeight = llGround(<0, 0, 0>);
pos.z = GroundHeight + MIN_HEIGHT;
llSetPos(pos);
}

changed(integer Change)
{
if (Change & CHANGED_LINK)
{
if (llAvatarOnSitTarget() != NULL_KEY)
{
Text("Welcome aboard!");
llSleep(3);
state going_up;
}
}
}
}

state going_up
{
state_entry()
{
Text("Going up...");
}

timer()
{
vector pos = llGetPos();
vector motion = <0, 0, 2>;
pos += motion;
float GroundHeight = llGround(<0, 0, 0>);
if (pos.z <= (GroundHeight + MAX_HEIGHT))
{
llSetPos(pos);
}
else
{
state going_down;
}
}

changed(integer Change)
{
if (Change & CHANGED_LINK)
{
if (llAvatarOnSitTarget() == NULL_KEY)
{
Text("Thanks for watching!");
llSleep(3);
state idle;
}
}
}
}

state going_down
{
state_entry()
{
Text("Going down...");
}

timer()
{
vector pos = llGetPos();
vector motion = <0, 0, -2>;
pos += motion;

float GroundHeight = llGround(<0, 0, 0>);
if (pos.z >= (GroundHeight + MIN_HEIGHT))
{
llSetPos(pos);
}
else
{
llUnSit(llAvatarOnSitTarget());
state idle;
}
llSetPos(pos);
}

changed(integer Change)
{
if (Change & CHANGED_LINK)
{
if (llAvatarOnSitTarget() == NULL_KEY)
{
Text("Thanks for watching!");
llSleep(3);
state idle;
}
}
}
}

_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Llauren Mandelbrot
Twenty-Four Weeks Old.
Join date: 26 Apr 2006
Posts: 665
11-15-2006 21:09
From: Jesse Barnett
Here you go rathlin. It was the font he was using on that webpage. SL couldn't read the quotation marks and the periods correctly.
Ah. That explains why I couldn`t see anything wrong but the way the text was formatted. Good job.
_____________________
  1. ninjafoo Ng Says:
    November 4th, 2006 at 7:27 am
    We all love secondlife so much and were afraid that the magic will end, nothing this good can ever last…. can it?

rathlin Zeno
Registered User
Join date: 28 May 2006
Posts: 12
11-18-2006 11:06
it worked - thanks so much!