Page 1 of 1

return value from

Posted: Tue Apr 01, 2008 8:00 pm
by hunt3r
I wanna show a message when a MoveCharacterToLocation fails...

Code: Select all

    var final:=MoveCharacterToLocation( who, jump_x, jump_y, jump_z );
    if( CInt(final) != 1 )
      ...
   endif
I've also tried with

Code: Select all

if (final != 1 )
if(!final)
if(final==error)
none of this methods works...

I "printed" the final var and this was what it shows
error{ errorText = "Can't go there" }
the point is... that var (final) returns 1 when success, and a error array when fails...
but I can't get the fail status on an if statement.

thanks

Posted: Tue Apr 01, 2008 8:45 pm
by *Edwards

Code: Select all

var final := MoveCharacterToLocation( who, jump_x, jump_y, jump_z ); 
if( final.errortext )
SendSysMessage( who, "The error is: "+final.errortext );
endif 
If you would get the statut you can always use:

If( !final ) // means that final has failed.
If( final ) // if success, do something...

http://docs.polserver.com/pol095/objref.php

Posted: Wed Apr 02, 2008 12:49 pm
by hunt3r
Thanks bud!
I`ll try that...

both
if(!final) and if(final) I`ve already tested and didn`t worked at all..

I`ll try final.errortext and see what happens :D

Thank once more!

Posted: Wed Apr 02, 2008 1:52 pm
by *Edwards
http://docs.polserver.com/pol097/escrip ... tml#chap1a

It's great tool for getting started. It's mostly the basic language theory.