Jump to content

Autoit V 3.0 Gosub?


demo
 Share

Recommended Posts

Ok im trying to make a program but version 3.0 wont allow me to use "GoSub" Command... What do I use instead? Here is my code so far.

;=======IniRead=====================

$LoadDelay = IniRead("Shenk.ini", "Global", "LoadDelay", "~~~ERROR~~~")

$Account = IniRead("Shenk.ini", "Global", "Account", "~~~ERROR~~~")

$Password = IniRead("Shenk.ini", "Global", "Password", "~~~ERROR~~~")

$CharLocation = IniRead("Shenk.ini", "Global", "CharLocation", "~~~ERROR~~~")

;=======Main=====================

GoSub("StartDiablo")

GoSub("Login")

GoSub("AcessChars")

;=======StartDiablo=====================

("StartDiablo:")

Run("C:\Program Files\Diablo II\Diablo II.exe -w -skiptobnet", "C:\Program Files\Diablo II")

Sleep("$LoadDelay")

WinActive("Diablo II")

WinMove("Diablo II,,0, 0, Default, Default")

Sleep(6000)

Return

;=======Login=====================

("Login:")

Sleep(500)

Send("{TAB}")

Sleep(500)

Send("$Account")

Sleep(500)

Send("{TAB}")

Sleep(500)

Send("$Password")

Sleep(500)

Send("{ENTER}")

Sleep(6000)

Return

;=======AcessChars=====================

("AcessChars:")

IfEqual("CharLocation", "1", "Send", "{ENTER}")

IfEqual("CharLocation", "2", "Send", "{RIGHT}{ENTER}")

IfEqual("CharLocation", "3", "Send", "{DOWN}{ENTER}")

IfEqual("CharLocation", "4", "Send", "{RIGHT}{DOWN}{ENTER}")

IfEqual("CharLocation", "5", "Send", "{DOWN}{DOWN}{ENTER}")

IfEqual("CharLocation", "6", "Send", "{RIGHT}{DOWN}{DOWN}{ENTER}")

IfEqual("CharLocation", "7", "Send", "{DOWN}{DOWN}{DOWN}{ENTER}")

IfEqual("CharLocation", "8", "Send", "{RIGHT}{DOWN}{DOWN}{DOWN}{ENTER}")

Sleep(6000)

Return

Edited by demo
Link to comment
Share on other sites

Change each "Gosub" to a function call.

StartDiablo()
Login()
AcessChars()
Exit

Suround the text that would follow each gosub label with Func and EndFunc, remove the Return that you are using. Return is now used to return a value which you don't need based on your example.. Here's one

Func StartDiablo()
Run("C:\Program Files\Diablo II\Diablo II.exe -w -skiptobnet", "C:\Program Files\Diablo II")
Sleep("$LoadDelay")
WinActive("Diablo II")
WinMove("Diablo II,,0, 0, Default, Default")
Sleep(6000)

EndFunc

I didn't check each line of your code, I just copied it to this reply.

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...