I wrote about it so i repeat..
additional parameter for Target*() calls - timeout for waiting. Now script stops on this call and waiting forever. Often it is not good.
Target*() timeout
Moderator: POL Developer
These two scripts might help in this situation (not tested!)
askfortarget.src sets a flag (cprop) on the player, starts a monitoring script (waitfortarget.src) and asks for a target. If the player does not chose a target within 5 seconds, waitfortarget.src kills the script askfortarget.src, which should also kill the target cursor. As I said above it's not tested, but should theoretically work
askfortarget.src sets a flag (cprop) on the player, starts a monitoring script (waitfortarget.src) and asks for a target. If the player does not chose a target within 5 seconds, waitfortarget.src kills the script askfortarget.src, which should also kill the target cursor. As I said above it's not tested, but should theoretically work
Code: Select all
// ----- askfortarget.src -----
use os;
use uo;
program askfortarget(who)
SetObjProperty (who, "#waitfortarget", ReadGameClock ());
start_script ("waitfortarget", array {who, GetPID (), 5});
var victim:= Target (who);
if (victim.acctname && (victim != who))
PrintTextAbovePrivate (victim, who.name + " targetted you.", victim);
else
SendSysMessage (who, "Cancelled.");
endif
EraseObjProperty (who, "#waitfortarget");
endprogram
Code: Select all
// ----- waitfortarget.src -----
use os;
use uo;
program waitfortarget(params)
var wait:= params[3];
var pid:= params[2];
var who:= params[1];
Sleep (wait);
if (GetObjProperty (who, "#waitfortarget"))
EraseObjProperty (who, "#waitfortarget");
GetProcess (pid).kill ();
endif
endprogram
I like this idea; let the Target() call expire, returning a specific error on timeout. The only thing I'd be interested in knowing about further would be could the target on the client be handled somehow, as just letting it sit there might be confusing. Though on expiration, the script could send a SysMessage or something to let the player know it expired, I guess.
And, I am afraid without some intense thread work (aka, won't work without multithreading enabled in pol.cfg), a core-side option will take some time to come up with. Unless I actually do my job and investigate all possibilities. Which, atm, takes more time than I got.
But, never underestimate my level of boredom. Already done several 096.1 fixes, and much more. Will see what I can do, outside of thread work.
But, never underestimate my level of boredom. Already done several 096.1 fixes, and much more. Will see what I can do, outside of thread work.