PenUltima Online

It is currently Fri Aug 29, 2008 4:17 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: macroing check
PostPosted: Sun Mar 09, 2008 9:53 am 
Offline

Joined: Tue Mar 04, 2008 7:02 am
Posts: 12
does a script that opens a dialog gump and ask a question
(in order to check wheter player is away or not) exists?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 09, 2008 11:30 am 
Offline
User avatar

Joined: Fri Feb 10, 2006 12:15 am
Posts: 206
You need couple of scripts that do communicate with each other.

1. Script that lauches 2. script and calculates time. When (if) time rans out, reacts -> player is probably AFK.
2. Script that creates and sends a macrocheck (whether is it gump or something else, is of course up to you). After player has answered sends information to 1. script.

Basic scripts, don't work as a whole, but should show the idea.

1., timeout.src
Code:
program SendMacroCheck( who )
   
    const PATH_TO_CHECK := "check";
    const ANSWERING_TIME := 120;
   
    var proc := Start_Script(PATH_TO_CHECK, { who, GetPid() } );
   
    var result := Wait_For_Event(ANSWERING_TIME);
   
    if (result == 0)
        // Timeout!
        SysLog(who.name + " is AFK!");
        // Kill's the gump off the player's screen.
        proc.Kill();
    else
        // Answered in time, no reaction.
        return 1;
    endif

endprogram


2., check.src
Code:
// Using yesNo gump (gumps-package) in this test

program check( params )
    var who := params[1];
    var pid := params[2];
    var proc := GetProcess(pid);
   
    // Return value does not matter; only the fact that player clicked.
    YesNo(who, "Are you AFK?");
   
    // Let timer script know that player clicked.
    proc.SendEvent(1);
endprogram


Now, this is in no way a complete solution! There's no error checking, nor do the scripts even compile; but that should give you some ideas.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 09, 2008 11:40 am 
Offline

Joined: Tue Mar 04, 2008 7:02 am
Posts: 12
there's not pre-made script yet ?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 09, 2008 11:54 am 
Offline
User avatar

Joined: Fri Feb 10, 2006 12:15 am
Posts: 206
Sure there is. I can't just think of any that is released to public.

Though I haven't looked into every single scriptbase out there, so chances are that if you do, you may find one. I wrote the advice above so that should you fail finding a complete solution, you may give a try scripting one.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 09, 2008 4:33 pm 
Offline

Joined: Sat Feb 04, 2006 6:26 pm
Posts: 539
The 097 distro has the targetUtil.inc
In that you can send a gump with a timer on it of any value you like.
If the timer runs out without them clicking the gump then disconnect them or whatever you like.


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

All times are UTC - 8 hours


Who is online

Users browsing this forum: Google [Bot] and 3 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