PenUltima Online

It is currently Sat Sep 06, 2008 6:53 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Timed Target Cursor
PostPosted: Thu Oct 11, 2007 10:42 pm 
Offline

Joined: Sat Feb 04, 2006 6:26 pm
Posts: 548
I tried using the TargetEX(who, time); functions and although they work I have some problems.

It is really easy to get a "nnnn used out-of-sequence target cursor" console error if you double click a target.

Also the function itself seems to be buggy: the second half after the return statment can't run can it?

Code:
function TargetEX(mobile, duration:=0, flags := TGTOPT_CHECK_LOS+TGTOPT_NEUTRAL)
   if ( duration > 0 )
      if ( CInt(TS_GetTimerDuration(mobile, "TargetControl")) > 0 )
         // Existing timer... stop it (itll cancel the old target)
         TS_LowerDuration(mobile, "TargetControl", -1);
      endif

      TS_StartTimer(mobile, "TargetControl", duration);
   endif

   return Target(mobile, flags);

   if ( duration > 0 )
      if ( CInt(TS_GetTimerDuration(mobile, "TargetControl")) > 0 )
         TS_LowerDuration(mobile, "TargetControl", -1);
      endif
   endif

   return 1;
endfunction


It also appears the program is killed when the timer runs down. Any reason for this? Wouldn't it just be better for the target cursor to cancel and the TargetEX return 0 if it timed out?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 12, 2007 12:10 am 
Offline

Joined: Sat Feb 04, 2006 6:26 pm
Posts: 548
Fixed by MuadDib in record time.
Fix available in distro SVN now.

Many thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 12, 2007 12:27 am 
Offline
POL Developer
User avatar

Joined: Sun Feb 12, 2006 9:50 pm
Posts: 836
Location: Indiana, USA
NP. Please be sure to do extensive testing and report back in irc or here :)

_________________
POL Developer - The Penguin Scripter


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 12, 2007 4:04 am 
Offline

Joined: Sat Feb 04, 2006 6:26 pm
Posts: 548
Yep, I am about to subject my staff to a square meal of TargetEX. This will soon weed out any problems.

As a matter of interest, the way MaudDib explained it, these functions are set up in such a way that it is important to test the function return for errors to avoid the "nnnn used out-of-sequence target cursor" errors. For example:

Code:
var targetted := TargetEX(who, 10);
if ( !targetted or targetted.errortext )
  return 0;
endif


Both TargetEX and TargetCoordinatesEX will now return an error if there is already a target cursor being displayed.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl