.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > General Bot Coding
General Bot Coding See what a pain it is to get those little mechs shooting around

Reply
 
Thread Tools
Re: keybd_event
Old
  (#11)
gavin
Member
 
Status: Offline
Posts: 6
Join Date: Sep 2005
Default Re: keybd_event - 27-09-2005

Ya thats basically it man thanks.
  
Reply With Quote
Re: keybd_event
Old
  (#12)
Lazy
Member
 
Lazy's Avatar
 
Status: Offline
Posts: 236
Join Date: Jan 2004
Location: Toronto, Ontario, Canada
Default Re: keybd_event - 27-09-2005

Hmm, it doesn't look like quake2 accepts keyboard input using window messages and I'm pretty sure Half-Life will be the same.
Though I could have sworn I did something similar, oh well.

Sorry but other then getting into half-life's address space and doing things from there I cannot figure out how else to do this.
  
Reply With Quote
Re: keybd_event
Old
  (#13)
gavin
Member
 
Status: Offline
Posts: 6
Join Date: Sep 2005
Default Re: keybd_event - 27-09-2005

Hey np man.
I'll try figure this out , unless i get sick of it.
Thanks anyways .
  
Reply With Quote
Re: keybd_event
Old
  (#14)
Austin
Moderator
 
Austin's Avatar
 
Status: Offline
Posts: 403
Join Date: Nov 2003
Default Re: keybd_event - 05-10-2005

I wrote this hack to monitor my cz dedicated server and restart it.
The part that may interest you is I look for the error message box window and "press" the ok button by sending it a space bar down and space bar up using PostMessage() . You can do the same for any key....

Code:
void CFindNBWindowDlg::OnTimer(UINT nIDEvent) 
{    
    HWND nbWindow, buttonWindow;

    nbWindow = ::FindWindow(NULL, "Fatal error - Dedicated server");
    if (::IsWindow(nbWindow))
    {
        buttonWindow = ::FindWindowEx(nbWindow, NULL, "Button", "Ok");
        if (::IsWindow(buttonWindow))
        {
            Log(" Fatal Error window close.\n");
            //::SetForegroundWindow(buttonWindow);
            ::PostMessage(buttonWindow, WM_KEYDOWN, (WPARAM)VK_SPACE, (LPARAM)0);
            ::PostMessage(buttonWindow, WM_KEYUP, (WPARAM)VK_SPACE, (LPARAM)0);
        }
    }
    else
    {
        nbWindow = ::FindWindow(NULL, "Console");
        if (!::IsWindow(nbWindow))
        {
            Log(" Restart.\n");
            Sleep(4000);
            WinExec("C:\\HLServer\\hlds.exe -game czero -noipx -nojoy -console", SW_SHOWMINIMIZED);
        }
    }    
    CDialog::OnTimer(nIDEvent);
}
Hope this helps..

Last edited by Austin; 05-10-2005 at 08:39..
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com