1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

AutoHotkey

Discussion in 'Fairy Land' started by Maffe811, May 13, 2011.

  1. Maffe811

    Maffe811 The forum pet Staff Member

    Joined:
    Jul 2, 2009
    Messages:
    6,813
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Norway/Norge/Norwegen
    Its basicly what i was looking for!
    You make a hotkey (example: Ctrl + M ) and it will execute a script or macro!
    In my case im gonna make it do stuff thats annoying to do in minecraft... :p

    Thought id share this program... ;D
     
  2. humblejohnny20

    humblejohnny20 Member

    Joined:
    Nov 17, 2010
    Messages:
    168
    Likes Received:
    0
    Trophy Points:
    16
    Lol, good memories - i used AHK, then AutoIt, then C++

    tbh i think Autoit has a much more 'normal' syntax (closer to C++ and VB, AHK is just weird with variable handling), AHK is basically a derivative of AutoIt early on when Autoit was open source.

    Scripting is fun though, you can do some crazy stuff in any language you choose.
     
  3. virtualTune

    virtualTune Active Member

    Joined:
    Sep 2, 2009
    Messages:
    4,421
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Neverland
    Home Page:
    use logitech and u can configure so many macros. 8O
     
  4. Maffe811

    Maffe811 The forum pet Staff Member

    Joined:
    Jul 2, 2009
    Messages:
    6,813
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Norway/Norge/Norwegen
    Logitech how ?
    Like the mouse ?
    Please explain since i have a Logitech Nano550... i think it is... :p

    Yeah, i think il go AHK > AutoIt > Some C++ > Java

    Ahh, i see! So this might be a good way to get into scripting?
    And i love the AHK help file!
    "Wondering about anything? Check the help file!"

    Yes, im currently making a script that when you press a hotkey it will show a drop down menu and a Ok button

    Then you select what script you want it to execute and so it does!
    Vóila! Multiple scripts on one(en español: Uno) button!

    You see im running my xbox trough my desktop to get internet on it, but to do that you need to bridge the Wlan-card and the ethernet-card... but when you're hosting your own minecraft server, the wlan card cant be bridged! So i have a script that will automaticly add/remove the wlan card from the bridge in like 10 seconds! Love it :D

    My only problem now is figuring out what else i can make it do... maybe draw in gimp ? :p
     
  5. virtualTune

    virtualTune Active Member

    Joined:
    Sep 2, 2009
    Messages:
    4,421
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Neverland
    Home Page:
    download the latest Logi software (Setpoint 6.22 I believe) and set your macros (note u also need a logi keyboard)

    I currently have 4 Logi devices in my room :)
     
  6. Willy

    Willy Member

    Joined:
    Mar 26, 2011
    Messages:
    746
    Likes Received:
    0
    Trophy Points:
    16
    Occupation:
    High School, Engineering Program
    Location:
    Michigan
    Home Page:
    I have there Wireless keyboard Wireless mouse combo and love them
     
  7. humblejohnny20

    humblejohnny20 Member

    Joined:
    Nov 17, 2010
    Messages:
    168
    Likes Received:
    0
    Trophy Points:
    16
    why Java ???

    Good languages:
    -C++
    -PHP
    -Javascript
    -Flash

    "toned-down"/easy-to-use-from-the-start languages:
    -AutoIt
    -Game Maker

    Worse languages IMO:
    -Java
    -Visual Basic
    -Scheme/lisp (default scripting language in Gimp)
    -Python
    -Microsoft Silverlight
    -hundreds of other obscure ones very few people use like fortran, pascal, etc.

    One funny game script i made (deleted it a while ago tho) in c++ was a bullet dodger - it automatically jumps around when you get shot at -some games have a console output that says "you were shot in the legs for 25% damage blabla"

    so you can make a script that dumps and parses the console output to a text file and clears it every 50 milliseconds or so, scanning for the words and jumping if it finds them.

    Also made a funny game-spam script once that chats random lines from a bible txt file every second :D .
     
  8. virtualTune

    virtualTune Active Member

    Joined:
    Sep 2, 2009
    Messages:
    4,421
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Neverland
    Home Page:
    could u redo it? :eek:
     
  9. humblejohnny20

    humblejohnny20 Member

    Joined:
    Nov 17, 2010
    Messages:
    168
    Likes Received:
    0
    Trophy Points:
    16
    The dodging one or the spam one ?

    Ya - even though its a complex script compared to most scripts,
    it takes only about 5 minutes to make (ive re-made it about 3 times)

    BUT-
    -the only game i know of that has console hit logging is urban terror
    -i dont have urban terror installed anymore :'(


    other things you can do with console dumping include doing a /playerlist command every few millisecs and extracting their names, then telling people gibberish. thats fun also. ^-^


    If u meant the chat spam one - that one could be made in like a minute - just bind m to 'exec myconfig.cfg', which your program wrote something to like 'bind n say blablabla', with blablabla being the random line read a txt file.

    Program then presses m', then n' every second, which m executes the config your program wrote to and binds n to the chat text, and n executes what was written to the config.


    OR for a simple method (which would interrupt gameplay every few seconds)
    you could just have the prog press your chat key, then paste your gibberish and press enter.
     
  10. Maffe811

    Maffe811 The forum pet Staff Member

    Joined:
    Jul 2, 2009
    Messages:
    6,813
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Norway/Norge/Norwegen
    Java, cause minecraft is written in it ;)
    My friend wants to learn C++ to create programs and iPhone apps, i wanna know some so i can help or atleast understand what he has written!

    But... Still growing up to be an electrician so i have to learn all this on my spare time, i know some spanish wich i want to evolve into full spanish, and i would also like to learn german since half the forum is german, and i have Baum and vT on steam ;D

    Also, does anyone have a suggestion for what i can automate next ? ive made a okay looking gui, but i need it to do stuff :p
    I can post the code if anyones interested
     
  11. humblejohnny20

    humblejohnny20 Member

    Joined:
    Nov 17, 2010
    Messages:
    168
    Likes Received:
    0
    Trophy Points:
    16
    Vamos :mad:

    for minecraft ? ive never played that, but a pattern placer would seems simple and fitting (to automate the tedious placement of a pattern over and over). Can you already do that easily without a script?
     
  12. Maffe811

    Maffe811 The forum pet Staff Member

    Joined:
    Jul 2, 2009
    Messages:
    6,813
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Norway/Norge/Norwegen
    Noh, i made a gui for my script!
    It has a hotkey wich shows the gui, with a drop down menu.
    From there you can select what script you want executed! ;D

    But yes, ive already made an auto-"remove whats in the oven, fill in new material to grill and new fuel" for minecraft...
    But all my scripts are based on X-Y positions, and my screen res is 1100x900 or sumthing like that...
    So it wont work for my other pc... :p

    I might make a simple tut series on this... Hmm....
     
  13. virtualTune

    virtualTune Active Member

    Joined:
    Sep 2, 2009
    Messages:
    4,421
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Neverland
    Home Page:
    At johnny, couldnt u use the dodge script for CSS?
     
  14. humblejohnny20

    humblejohnny20 Member

    Joined:
    Nov 17, 2010
    Messages:
    168
    Likes Received:
    0
    Trophy Points:
    16
    idk, does CSS have hit logging? (never played it b4)

    theres probably other ways to detect getting hit also, like screen changes (color flashes, etc)
     
  15. virtualTune

    virtualTune Active Member

    Joined:
    Sep 2, 2009
    Messages:
    4,421
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Neverland
    Home Page:
    i think it does.... idk.... :(
     
  16. Maffe811

    Maffe811 The forum pet Staff Member

    Joined:
    Jul 2, 2009
    Messages:
    6,813
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Norway/Norge/Norwegen
    CS is a life based game!
    a simple idea:

    Loop
    {
    Get CurrentHealth = Life
    If life =< CurrentHealth
    {
    Do some crazy shit
    }
    }
     
  17. humblejohnny20

    humblejohnny20 Member

    Joined:
    Nov 17, 2010
    Messages:
    168
    Likes Received:
    0
    Trophy Points:
    16
    is that some autohotkey syntax ? :eek:


    heres a minimal c++ script i made the other day - nothing complex, just to illustrate how simple c++ can be

    what this one does is sets your power scheme to balanced when shooting, and then back to power saver after a delay to conserve power and avoid overheating, E.G gaming on a laptop.

    i didn't indent the code, but you can compile it with code::blocks, which comes with minGW (the best free c++ compiler, and under 100 mb)

    If i end up making the dodge script again, ill post it here..

    if anyone wants a recoil script source code, thats real easy too.. just ask and ill whip it up in 1 minute xD

    Code:
    #include <windows.h>
    
    int main()
    
    {
    int Timer=0;
    
    system("powercfg.exe -setactive a1841308-3541-4fab-bc81-f71556f20b4a");
    
    while(1)
    {
    
    
    
    Sleep(30);
    
    Timer++;
    
    
    if(  (GetAsyncKeyState(VK_LBUTTON)&0x8000)  )
    {
    system("powercfg.exe -setactive 381b4222-f694-41f0-9685-ff5bb260df2e");
    }
    
    
    if(  (!GetAsyncKeyState(VK_LBUTTON)&0x8000) && (Timer>180)  )
    {
    Timer=0;
    system("powercfg.exe -setactive a1841308-3541-4fab-bc81-f71556f20b4a");
    }
    
    
    
    
    }
    
    }
    
    


    here was some primitive urban terror spambot i made like years ago:

    sounds like a terrible waste of time hahahaha but was good programminf practice lol


    urbanterror Spambot - spams "*Name* GOT SHOT IN THE HEAD OMFG" whenever someone gets killed, also has a private chat spammer - sends private chat spams to random people harvested from a list - evades admins by avoiding private chat ppl with a tag:

    Code:
    //sv_cheats 1;bot_enable 1;devmap ut4_riyadh
    
    //For pixel functions - libgdi32.a
    
    #define DEBUG
    
    #include "include\simple.cpp"
    #include "include\keydefs.h"
    #include "include\windows.cpp"
    
    
    void Chat(string Text);
    
    
    
    string Condump;
    bool NotFound=0;
    string Target;
    int Number;
    string Avoid;
    int PlayerCount;
    int PlayerSelected;
    int Player;
    string PlayerName;
    string Impersonate;
    int ChangeTimer=0;
    string MyText;
    string Gibberish;
    int i=0;
    int main()
    {
    Init();
    
    cout<<StringDSV("aa,bb,cc,dd",",",2)<<endl;
    
    
    while(1)
    {
    
    
    Sleep(800); //Weak server
    
    
    
    
    Key(KEY_0);
    Condump=FileRead("C:\\Users\\Admin\\AppData\\Roaming\\Quake3\\q3ut4\\output.txt");
    Sleep(25);
    if(StringCount(Condump,"SR-8")>0)
    {
    Target=StringBetween(Condump,"slow down ","'s SR-8",1);
    //Chat("SOMEONE GOT SHOT IN THE HEAD OMFG!?!! " + Target+ " SHOT IN THE HEAD BOOM");
    Condump="";
    //Sleep(4000);
    }
    
    
    
    
    Key(KEY_9);
    Sleep(25);
    Condump=FileRead("C:\\Users\\Admin\\AppData\\Roaming\\Quake3\\q3ut4\\output.txt");
    PlayerCount=StringCount(Condump,":")-2;
    
    
    
    
    NotFound=1;
    
    while(NotFound==1)
    {
    PlayerSelected=IntRandom(0,PlayerCount);
    string Find=IntToString(PlayerSelected)+": [";
    cout<<Find<<endl;
    PlayerName=StringBetween(Condump,Find,"]",1);
    cout<<PlayerName<<endl;
    cout<<StringCount(PlayerName,"WC")<<endl;
    if(    (StringCount(PlayerName,"WC")==0) &&(StringCount(PlayerName,"wc")==0) ) //&&(StringCount(PlayerName,"Paladin")==0)   )
    {
    NotFound=0;
    }
    
    }
    
    Gibberish=StringDSVRandom(FileRead("insults.txt"),Newline);
    
    cout<<Gibberish+" "+PlayerName<<endl;
    
    FileWrite("C:\\Users\\Admin\\AppData\\Roaming\\Quake3\\q3ut4\\exec.cfg","bind 8 tell "+IntToString(PlayerSelected)+ " \"" +Gibberish+" "+PlayerName+"\"");
    Key(KEY_7);
    
    Key(KEY_8);
    
    
    
    }
    
    
    
    
    
    
    
    
    
    }
    
    
    
    
    
    void Chat(string Text)
    {
    Key(KEY_T);
    Paste(Text);
    Key(VK_RETURN);
    }
    
    



    BUT this one wont compile Unless i posted the missing headers - because the all-purpose includes which reference functions are seperate files.

    i.e. StringCount is not a standard c++ funtion - you'd have to make your own version.


    This is the "StringCount" func i use quite a bit

    Code:
    int StringCount(string Input, string String1)
    {
    int Count=0;
    string::size_type Position;
    Position=Input.find(String1);
    while(!(Position==string::npos))
    {
    Count++;
    Position+=String1.length();
    Position=Input.find(String1,Position);
    }
    return Count;
    }
    
     
  18. Maffe811

    Maffe811 The forum pet Staff Member

    Joined:
    Jul 2, 2009
    Messages:
    6,813
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Norway/Norge/Norwegen
    Noh, Maffe syntax :p
     
  19. humblejohnny20

    humblejohnny20 Member

    Joined:
    Nov 17, 2010
    Messages:
    168
    Likes Received:
    0
    Trophy Points:
    16
    maffe811:
    do you want the screenshot thing in c++ or autoit? Can't do AHK. i was only going to do autoit but i actually still have screenshot code for c++ around.
     
  20. Maffe811

    Maffe811 The forum pet Staff Member

    Joined:
    Jul 2, 2009
    Messages:
    6,813
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Norway/Norge/Norwegen
    Whatever you find to be easier! :)
     

Share This Page