Tuesday, December 02, 2008
USERLOGIN PASSWORD Remember?
You are here » Learning Center ยป Forums

Openlife Forums

 Openlife Grid Forums
Minimize
 
  Openlife Forums  Scripting  LSL Help  Door Script Error (CS1520) -From Previous Forums.
Previous Previous
 
Next Next
New Post 2/12/2008 12:13 AM
Online now... Sakai Openlife
609 posts
openlifegrid.com
Openlife Senior




Door Script Error (CS1520) -From Previous Forums. 

User



Location:

Joined on:
17-Jan-2008 07:07:01
Posted:
3 posts
Armasyll
# Posted on: 19-Jan-2008 07:52:14.   Edit | Quote
I get this message:
Code:
Line number 10, Error Number: CS1520, 'Class, struct, or interface method must have a return type'

Code:
Line number 22, Error Number: CS1520, 'Class, struct, or interface method must have a return type'


When trying to run/save this script:
Code:
vector pos;             // closed position when script is reset
vector opos;            // open position
rotation rot;
float amt = 1.8;        // how far to slide, in meters
integer dir = -1;     // direction to slide. change sign to switch
float offset = 0.1;     // a little in or out as opposed to left right.
integer open;         // TRUE is open.
float delay = 20;     // seconds to stay open
integer slice = 4;     // how many steps during open and close
slide( vector tgt )
{ //THIS IS LINE 10
    vector opos = llGetPos();
    vector delta = (tgt - opos)/slice;
    integer s;
    for( s=1; s < slice; ++s )
    {
        opos += delta;
        llSetPos( npos );
    }
    llSetPos(tgt);
} //THIS IS LINE 22
close()
{
        llSetTimerEvent(0);
        slide(pos);
        llSetPos(pos);
        llSetRot(rot);
        open = FALSE;
}
default
{
    state_entry()
    {
        pos = llGetPos();
        rot = llGetRot();
        opos = pos + dir*(<0,amt,offset>*rot); // assumes x axis is UP
        open = FALSE;
    }
    on_rez(integer n)
    {
        llResetScript();
    }
    touch_start(integer total_number)
    {
        if( open )
        {
            close();
        }
        else
        {
            slide(opos);
            llSetTimerEvent(delay);
            open = TRUE;
        }
    }
    timer()
    {
        close();
    }
}


I don't understand LSL very well, is there a workaround or a fix to the problem I'm having?

Sakai Openlife
Openlifegrid.com Founder

Exciting things are happenning!
http://openlifegrid.com
 
New Post 2/25/2008 12:25 PM
User is offline Pablo Pharmanaut
56 posts
Openlife Apprentice




Re: Door Script Error (CS1520) -From Previous Forums. 

I believe llSetRot isn't implemented yet.

 
New Post 2/25/2008 2:32 PM
User is offline cyberpunk
7 posts
Openlife Newbie


Re: Door Script Error (CS1520) -From Previous Forums. 
Modified By cyberpunk  on 2/25/2008 2:43:22 PM)

I compiled and ran this and found a typo in line 18 (npos) but no problem. I also had an error at the line 45 with the if(open).

Line number 45, Error Number: CS0029, 'Cannot implicitly convert type 'int' to 'bool''

I have found you can not have just   if(open)     you must use    if(open == TRUE)   which to us is the same thing but not to this compiler :)

I made that one change and fixed the typo npos and it works great as a sliding door. As far as your errors Im not sure but I think I have been using a return; at the end of my functions and that solves the return type errors.

 

 

 

 

 

 

 
Previous Previous
 
Next Next
  Openlife Forums  Scripting  LSL Help  Door Script Error (CS1520) -From Previous Forums.
Privacy Statement | Terms Of UseAll Rights Reserved 2007,2008 3DX - Openlifegrid.com