Jump to content
Sign in to follow this  
AlmarM

Runescape AutoTalker

Recommended Posts

AlmarM

Hi,

We all know the game RuneScape from Jagex. So here's my first contribution for it! :D

Global $Version = "v1.0"
Global $Title = "Runescape AutoTalker " & $Version

Global $SET_COLOR = "Nothing|White|Cyan|Red|Green|Purple|Glow 1|Glow 2|Glow 3|Flash 1|Flash 2|Flash 3"
Global $SET_EFFECT = "Nothing|Wave 1|Wave 2|Shake|Scroll|Slide"

Global $SAV_COLOR, $SAV_EFFECT, $SAV_WIN, $SAV_TEXT, $SAV_LOOP, $SAV_DELAY
Global $DEF_COLOR = "<Select Color>", $DEF_EFFECT = "<Select Effect>", $DEF_WIN = "<Select Window>", $DEF_TEXT = "", $DEF_LOOP = 10, $DEF_DELAY = 2500
Global Const $GUI_DISABLE = 128

MsgBox(64, $Title, "Dont forget to press Save before pressing Start!")

$GUI = GUICreate($Title, 420, 350)

; Effect
GUICtrlCreateGroup("Effect", 10, 10, 120, 85)
$Text_Color = GUICtrlCreateCombo("<Select Color>", 20, 30, 100)
$Text_Effect = GUICtrlCreateCombo("<Select Effect>", 20, 60, 100)

; Window
GUICtrlCreateGroup("Window", 140, 10, 270, 55)
$Window = GUICtrlCreateCombo("<Select Window>", 150, 30, 200)
$Detect = GUICtrlCreateButton("Detect", 360, 27)

; Text
GUICtrlCreateGroup("Text", 140, 70, 270, 220)
$Edit = GUICtrlCreateEdit("", 150, 90, 250, 150)
$Add = GUICtrlCreateButton("Add", 150, 250, 100)
$Clear = GUICtrlCreateButton("Clear", 300, 250, 100)
GUICtrlSetState($Edit, $GUI_DISABLE)

; Etc
$Save = GUICtrlCreateButton("Save Settings", 10, 105, 120)
$Show = GUICtrlCreateButton("Show Settings", 10, 135, 120)
$Default = GUICtrlCreateButton("Set Default", 10, 165, 120)
$Help = GUICtrlCreateButton("Help", 10, 195, 120)
$About = GUICtrlCreateButton("About", 10, 225, 120)
$Start = GUICtrlCreateButton("Start", 10, 255, 120)

; Loop
GUICtrlCreateGroup("Loop", 10, 290, 210, 50)
GUICtrlCreateLabel("Repeat:", 20, 310)
$Loop = GUICtrlCreateInput(10, 65, 307, 40)
$LoopEx = GUICtrlCreateUpDown($Loop)
GUICtrlCreateLabel("Delay:", 120, 310)
$Delay = GUICtrlCreateInput(2500, 160, 307, 50)
$DelayEx = GUICtrlCreateUpDown($Delay)
GUICtrlSetTip($Delay, "In milliseconds.")

; Lol
$lol = GUICtrlCreateLabel("<Empty Space>", 280, 310)

; Do Stuff
_SetComboData(0)
_SetComboData(1)
_SetWinList()
GUICtrlSetLimit($LoopEx, 999, 1)

GUISetState()
While 1
    $nMsg = GUIGetMsg()
    Select
    Case $nMsg = -3
        Exit
        
    Case $nMsg = $Detect
        _DetectRunescape($Window)
        
    Case $nMsg = $Add
        _Add($Edit)
        
    Case $nMsg = $Clear
        GUICtrlSetData($Edit, "")
        
    Case $nMsg = $Save
        _Save(GUICtrlRead($Text_Color), GUICtrlRead($Text_Effect), GUICtrlRead($Window), GUICtrlRead($Edit), GUICtrlRead($Loop), GUICtrlRead($Delay))
        
    Case $nMsg = $Show
        MsgBox(64, $Title, "Text Color: " & $SAV_COLOR & @CRLF & _
                            "Text Effect:   " & $SAV_EFFECT & @CRLF & _
                            "Window:        " & $SAV_WIN & @CRLF & _
                            "Loop:      " & $SAV_LOOP & @CRLF & _
                            "Delay:     " & $SAV_DELAY)
    
    Case $nMsg = $Default
        _SetDefault($Text_Color, $Text_Effect, $Window, $Edit, $Loop, $Delay)
        
    Case $nMsg = $Help
        MsgBox(64, $Title, "Oh, cmon! This isn't that hard! Try again!")
        
    Case $nMsg = $About
        MsgBox(64, $Title, "Made by:" & @CRLF & "Almar 'Lyker' Mulder" & @CRLF & "          " & $Title)
        
    Case $nMsg = $Start
        _Start($SAV_COLOR, $SAV_EFFECT, $SAV_WIN, StringSplit($SAV_TEXT, Chr(10)), $SAV_LOOP, $SAV_DELAY)
        
    Case $nMsg = $lol
        MsgBox(64, "Woot!", "Woot! A hidden message! :o ")
        
    EndSelect
WEnd

Func _DetectRunescape($Ctrl)
    $List = WinList()
    
    For $i = 1 To $List[0][0]
        If $List[$i][0] <> "" And IsVisible($List[$i][1]) And StringInStr($List[$i][0], "RuneScape", 1) Then
            GUICtrlSetData($Ctrl, $List[$i][0])
        EndIf
    Next
EndFunc

Func _Add($Ctrl)
    $Input = InputBox($Title, "Enter your text here.")
    If StringLen($Input) > 71 Then
        MsgBox(16, "ERROR", "Too long, please try again!")
        _Add($Ctrl)
    ElseIf $Input == "" Then
    Else
        GUICtrlSetData($Ctrl, $Input & @CRLF, "|")
    EndIf
EndFunc

Func _Save($Color, $Effect, $Win, $Text, $Loop, $Sleep)
    $SAV_COLOR = $Color
    $SAV_EFFECT = $Effect
    $SAV_WIN = $Win
    $SAV_TEXT = $Text
    $SAV_LOOP = $Loop
    $SAV_DELAY = $Sleep
EndFunc

Func _SetDefault($Ctrl1, $Ctrl2, $Ctrl3, $Ctrl4, $Ctrl5, $Ctrl6)
    GUICtrlSetData($Ctrl1, $DEF_COLOR)
    GUICtrlSetData($Ctrl2, $DEF_EFFECT)
    GUICtrlSetData($Ctrl3, $DEF_WIN)
    GUICtrlSetData($Ctrl4, $DEF_TEXT)
    GUICtrlSetData($Ctrl5, $DEF_LOOP)
    GUICtrlSetData($Ctrl6, $DEF_DELAY)
EndFunc

Func _Start($_Color, $_Effect, $_Window, $_Text, $_Loop, $_Delay)
    $clr = _GetColor($_Color)
    If $clr = -1 Then
        MsgBox(16, "ERROR", "Please select a color!")
    Else
        $eff = _GetEffect($_Effect)
        If $eff = -3 Then
            MsgBox(16, "ERROR", "Please select a effect!")
        Else
            WinActivate($_Window)
            WinWaitActive($_Window)
            
            For $i = 1 To $_Loop
                For $ii = 1 To $_Text[0] -1
                    ControlSend($_Window, "", "", $clr & $eff & $_Text[$ii] & "{ENTER}")
                    Sleep(100)
                    Send("{ESC}")
                    Sleep($_Delay - 100)
                Next
            Next
        EndIf
    EndIf
EndFunc

Func _GetColor($_clr)
    If $_clr = "Nothing" Then Return ""
    If $_clr = "White" Then Return "white:"
    If $_clr = "Cyan" Then Return "cyan:"
    If $_clr = "Red" Then Return "red:"
    If $_clr = "Green" Then Return "green:"
    If $_clr = "Purple" Then Return "purple:"
    If $_clr = "Glow 1" Then Return "glow1:"
    If $_clr = "Glow 2" Then Return "glow2:"
    If $_clr = "Glow 3" Then Return "glow3:"
    If $_clr = "Flash 1" Then Return "flash1:"
    If $_clr = "Flash 2" Then Return "flash2:"
    If $_clr = "Flash 3" Then Return "flash3:"
    
    $_split = StringSplit($SET_COLOR, "|")
    For $i = 2 To $_split[0]
        If $_clr <> $_split[$i] Then Return -1
    Next
EndFunc

Func _GetEffect($_eff)
    If $_eff = "Nothing" Then Return ""
    If $_eff = "Wave 1" Then Return "wave1:"
    If $_eff = "Wave 2" Then Return "wave2:"
    If $_eff = "Shake" Then Return "shake:"
    If $_eff = "Scroll" Then Return "scroll:"
    If $_eff = "Slide" Then Return "slide:"
    
    $_split = StringSplit($SET_EFFECT, "|")
    For $i = 2 To $_split[0]
        If $_eff <> $_split[$i] Then Return -1
    Next
EndFunc

Func _SetComboData($vOption = 0)
    If $vOption = 0 Then
        $SET_COMBO = $Text_Color
        $SET_DATA = $SET_COLOR
    Else
        $SET_COMBO = $Text_Effect
        $SET_DATA = $SET_EFFECT
    EndIf
    
    GUICtrlSetData($SET_COMBO, $SET_DATA)
EndFunc

Func _SetWinList()
    $List = WinList()
    
    For $i = 1 To $List[0][0]
        If $List[$i][0] <> "" And IsVisible($List[$i][1]) Then 
            GUICtrlSetData($Window, $List[$i][0])
        EndIf
    Next
EndFunc

Func IsVisible($Handle)
    If BitAnd(WinGetState($Handle), 2) Then 
        Return 1
    Else
        Return 0
    EndIf
EndFunc

Tell me what you think.

Oh, if you see anything that could be done better, tell me :D

AlmarM


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites
SkellySoul

Oh, if you see anything that could be done better, tell me :D

AlmarM

Code Updated

;Insert New Game here!

;...
;...
;...

but in all seriousness nice code but the game not so much not that I can say anything really use to love it when I was 12 that was classical RS when Autoit could of actually been of use if only I knew about Autoit sooner :D

Share this post


Link to post
Share on other sites
AlmarM

Code Updated

;Insert New Game here!

;...
;...
;...

but in all seriousness nice code but the game not so much not that I can say anything really use to love it when I was 12 that was classical RS when Autoit could of actually been of use if only I knew about Autoit sooner :D

Thx ^^,

But whats with the Code Updated?


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites
jvanegmond

I think SkellySoul, lacking proper punctuation, is trying to say that Runescape was a lot of fun when was 12 but that it's time for a new game. I don't see how just because he is done with the game, it applies to everyone but I'm sure he has a reason for posting what he did.

Share this post


Link to post
Share on other sites
AlmarM

Runescape was fun when I was young, I stopped playing it to a long time ago.

AlmarM


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×