PDA

View Full Version : Argh! Can someone explain this . . . !



Matt
11-11-2003, 08:14 AM
This isn't the script I'm writing but a small test script to illustrate what isn't working!

In this example I want to list the coords for the second from last point selected, and this script crashes Modeller:

main
{
// Why can't I minus 1 test!

// Get users selection
selmode(USER);

totalpoints=editbegin();

info("coords: ", pointinfo(points[totalpoints-1]));

} // End main


and when I tried this:


main
{
// Why can't I minus 1 test!

// Get users selection
selmode(USER);

secondlast=1;

totalpoints=editbegin();

secondlast=totalpoints-1;

info("coords: ", pointinfo(points[secondlast]));

} // End main

I received an error saying "Found '-' expected '@'"

Putting in an editend() makes no difference either.

So how in the hell would you find the second from last point in the point array?!?!

I'm sure this is dead simple, but I'm well out of practice at coding!

Cheers
Matt

faulknermano
11-11-2003, 09:35 AM
there must be a whitespace on both sides of a minus sign.



info("coords: ", pointinfo(points[totalpoints - 1]));

Matt
11-11-2003, 10:43 AM
that's just daft!

thanks for the help with this lscript stuff faulknermano!

:D

zander
11-17-2003, 12:14 PM
Wow, that's phenomenally bad.

After fooling around with Lscript for a while, I just kind of assumed that it didn't do in-line computations. But, it turns out the Lscript pre-parser is braindead?

faulknermano
11-18-2003, 10:30 AM
not sure what you mean by "in-line" but regarding using the minus sign: bob explained it way back. it was a mistake. but depending on who you are, it should be no big deal - though it ought to be properly documented. :)

zander
11-18-2003, 11:16 AM
By "in-line" I just mean a series of commands. The Lscript parser *should* be able to figure out what this means...

info( points[pntCnt].polygon().count() )

But it's confused. It returns 0.

In order to get the count of the array you have to do this...

tempArray = points[pntCnt].polygon()
info( tempArray.count() )

It's not a huge deal. Obviously you can work around it. But, it's not very robust (or forgiving.)

I'm just complaining for no good reason. :) Feel free to ignore me. :)