PDA

View Full Version : My Lscript doesn't work..



stevecullum
07-27-2010, 12:40 PM
I'm dipping a toe into Lscripting, but its a bit cold right now!

I have this simple script, that is meant to create 3 points, move the first one to a new location, creates a poly then subdivide the result. It works except its not moving the point. Can anyone tell me where I've gone wrong?

main
{

location = <0,5,0>;
editbegin();
point[1]=addpoint(0,0,0);
point[2]=addpoint(0,1,0);
point[3]=addpoint(1,0,0);
pointmove (point[1],location);
polygon = addpolygon(point);


editend();
subdivide(FLAT);

}

Matt
07-27-2010, 01:12 PM
Just tried it, no idea, doesn't seem to be anything wrong with your code.

Myagi
07-27-2010, 02:02 PM
Add a editend/editbegin after the points have been added. I'm guessing that the addpoint operations will not be fully commited until editend is called, so pointmove doesn't work.



...
point[1]=addpoint(0,0,0);
point[2]=addpoint(0,1,0);
point[3]=addpoint(1,0,0);

editend();

editbegin();

pointmove (point[1],location);
...

Matt
07-27-2010, 02:12 PM
Doh!

stevecullum
07-27-2010, 02:13 PM
Add a editend/editbegin after the points have been added. I'm guessing that the addpoint operations will not be fully commited until editend is called, so pointmove doesn't work.

Thanks. It does say something about all the mesh editing being held in a buffer. So I assume it fails, because the vector info for point 1 doesn't actually exist, until after the editend is called.

Cheers! Toe warming up again :)

jameswillmott
07-27-2010, 02:48 PM
I'm dipping a toe into Lscripting, but its a bit cold right now!

I have this simple script, that is meant to create 3 points, move the first one to a new location, creates a poly then subdivide the result. It works except its not moving the point. Can anyone tell me where I've gone wrong?

main
{

location = <0,5,0>;
editbegin();
point[1]=addpoint(0,0,0);
point[2]=addpoint(0,1,0);
point[3]=addpoint(1,0,0);
pointmove (point[1],location);
polygon = addpolygon(point);


editend();
subdivide(FLAT);

}

That's a bit odd. Why make point[1] at 0,0,0 then move it? Just make it where it needs to be.

point[1]=addpoint( location );

Other than that Myagi is quite correct, you can't do anything to a point/polygon until you commit it by doing an editend()

stevecullum
07-27-2010, 03:22 PM
That's a bit odd. Why make point[1] at 0,0,0 then move it? Just make it where it needs to be.

Because I'm still in embryonic mode :D

I know very little about how any of this stuff works, so just trying to get a feel for the syntax and how different arguments work with commands.

I have an idea for a script, which I will start the pseudo-code part on next week. Going to be fun if I can actually turn that into something that works! :)