Jump to content

Learning to Script - Need alittle Help


 Share

Recommended Posts

Im new to AutoIt, Ive never in my years woulda guest this place existed, hahah

But I come from a few Diffrent Programing Languages, LSL(Secondlife Scripting) and MIRC(MIRC Scripting <-- Lame I know.) Also I do alittle Coding in TCL

Currently im working on a Script for the Game Holy Beast Online.

Now Ive seen Snow's Code and Im working on Something Alittle Diffrent.

HotKeySet("{home}", "Start")
HotKeySet("{end}", "Pause")
Func Pause()
    $game = "0"
    Play($game)
EndFunc
Func Start()
    $game = "1"
    Play($game)
EndFunc
Func Play(ByRef $a)
    if $game = "1" Then
        For $i = 1 to 100
            Send("{TAB}")
            Sleep(250)
            Send("1")
            Sleep(500)
            Send("3")
            Sleep(500)
            Send("2")
            Sleep(3000)
            Send("4")
        Next
    EndIf
EndFunc

Again ive never scripted in AutoIT Scripting so I litteraly have no Clue, I did this in like 10 Minutes of Looking at the Help file but Im kinda Stuck, Im working Towards trien to Detect in the IF Statement

If ($game != TRUE) {

Return

}

or

if ($game != 1) {

Return

}

But i have yet to find out how to do that, anyone wanna give a Helping hand? And explain to me alittle.

Please hahaha

Thanks.

Link to comment
Share on other sites

I simply would use ELSE in your code. You set the values of $game so there is only "0" and "1" possible.

Func Play(ByRef $a)
  if $game = "1" Then
    For $i = 1 to 100
      Send("{TAB}")
      Sleep(250)
      Send("1")
      Sleep(500) 
      Send("3")
      Sleep(500)
      Send("2")
      Sleep(3000)
      Send("4")
    Next
  Else
    ... do something else ...
  EndIf
EndFunc
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...