Sign in to follow this  
Followers 0
verto

Help calling a variable

6 posts in this topic

I need to call a variable inside a text string, so it looks something like this

MsgBox(1, "Welcome to LockBot '$ver'", "Press F9 to start the lockbot '$ver' , F10 to Configure it, and F11 to stop it. Please read the readme for any required info that you may need.")

but instead of outputting '$ver' like it is, I want it to output the value I have assigned to $ver which is v0.1. A little help on this please?

Share this post


Link to post
Share on other sites



Here you go.

$ver = "v0.1"
MsgBox(1, "Welcome to LockBot " & $ver, "Press F9 to start the lockbot " & $ver & ", F10 to Configure it, and F11 to stop it. Please read the readme for any required info that you may need.")

Share this post


Link to post
Share on other sites

how can I get this to work?

$hpstone = IniRead("LockBot" & $ver ".ini", "Health", "hpstone", "ERROR")

Thanks for the fast reply btw. Other forums I've tried took days and not a single reply =\

Share this post


Link to post
Share on other sites

Here you go.

Or he can set Option ExpandVarStrings...

Opt("ExpandVarStrings", 1)

MsgBox(1, "Welcome to LockBot '$ver$'", "Press F9 to start the lockbot '$ver$' , F10 to Configure it, and F11 to stop it. Please read the readme for any required info that you may need.")

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

how can I get this to work?

After the string you forgot to put an “And” statment & ...

$hpstone = IniRead("LockBot" & $ver & ".ini", "Health", "hpstone", "ERROR")
Edited by MsCreatoR

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

Ok, that did it. Now I've one more question. This one is a wee bit more complex lol.

well let me post the code first:

#region _startbot
Func startbot()
    Beep(500, 1000)
IniRead("lockbot" & $ver & ".ini", "zone", "zone", "bg")
#region BGEnter
If $zone = "bg" Then
    Do
    TrayTip("Lock Bot " & $ver & "", "Drawing previous Configurationurations from LockBot" & $ver & ".ini, please wait...", 5) 
Sleep(1000) 

WinActivate("World of Warcraft")
TrayTip("LockBot" & $ver & "", "Maximizing World of Warcraft.", 5)
Sleep(2500)
Do
MouseMove(0, 0)
TrayTip("LockBot" & $ver & "", "Scanning for the Battlemaster.", 5)
Sleep(1500)
$bmfind = PixelSearch(0, 0, 1500, 1500, $battlemasterpix, 1, 1)
if @Error Then
TrayTip("LockBot" & $ver & "", "Adjusting our position, then trying again...", 5)
Send("{D down}")
Sleep(Random(400, 800))
Send("{D up}")
Sleep(Random(400, 800))
Else
TrayTip("LockBot" & $ver & "", "Joining the queue for the battleground.", 5)
Sleep(Random(1000, 2000))
Do
MouseClick("right", $bmfind[0], $bmfind[1], 2)
$queuemaybe = PixelGetColor($gotobgcoordsx, $gotobgcoordsy)
Until $queuemaybe = $gotobgpix
MouseClick("left", $gotobgcoordsy, $gotobgcoordsy, 2)
Sleep(Random(1000, 2000))
MouseClick("left", $joinbattlebuttonx, $joinbattlebuttony, 2)
Sleep(Random(1000, 2000))
MouseClick("left", $joinbattlebuttonx, $joinbattlebuttony, 2)
TrayTip("LockBot " & $ver & "", "Waiting to join the battleground.", 5)
Sleep(Random(1000, 2000))
Do
$inbg = PixelGetColor($joinedbgcoordsx, $joinedbgcoordsy)
Sleep(Random(400, 800))
Until $joinedbgpix <> $inbg
if $travelpath = "ON" Then
If $bgname = "AB" Then
TrayTip("LockBot " & $ver & "", "Running to our faction's primary node.", 5)
Sleep(Random(12000, 13000))
Send("{W down}")
Sleep(Random(3500, 4500))
Send("{W up}")
Sleep(Random(75000, 100000))
Send("{W down}")
Sleep(Random(10000, 12000))
Send("{W up}")
Send("{A down}")
Sleep(Random(200, 500))
Send("{A up}")
Send("{W down}")
Sleep(Random(10000, 11000))
Send("{W up}")
Send("{D down}")
Sleep(Random(200, 500))
Send("{D up}")
Sleep(Random(200, 500))
Send("{W down}")
Sleep(Random(5000, 6500))
Send("{W up}")
EndIf
If $bgname = "AV" Then
TrayTip("LockBot " & $ver & "", "Moving up then dancing.", 5)
Sleep(Random(10000, 20000))
Send("{W down}")
Sleep(Random(15500, 24500))
Send("{W up}")
Sleep(500)
Send("{ENTER}")
Sleep(500)
Send("/dance")
Sleep(500)
Send("{ENTER}")
Sleep(500)
EndIf
if $bgname = "WSG" Then
TrayTip("LockBot " & $ver & "", "Backing up then dancing...let's pretend we're on defense.", 5)
Sleep(Random(10000, 20000))
Send("{S down}")
Sleep(Random(3000, 3500))
Send("{S up}")
Sleep(500)
Send("{ENTER}")
Sleep(500)
Send("/dance")
Sleep(500)
Send("{ENTER}")
Sleep(500)
EndIf
EndIf
if $excuseon = "NO" Then
;
Else
Send("{ENTER}")
Sleep(500)
Send($excusemsg)
Sleep(500)
Send("{ENTER}")
Sleep(500)
EndIf
TrayTip("LockBot " & $ver & "", "Anti-AFK mode enabled until the end of the battle.", 5)
Do
MouseMove(0, 0)
$exityet = PixelGetColor($leavebgposx, $leavebgposy)
if $exityet <> $leavebgpix Then
Sleep(Random(30000, 50000))
$direction = Random(1, 4)
if $direction = 1 Then Send("D")
if $direction = 2 Then Send("S")
if $direction = 3 Then Send("A")
if $direction = 4 Then Send("W")
TrayTip("LockBot " & $ver & "", "Anti-AFK mode enabled until the end of the battle.", 5)
EndIf
Until $exityet = $leavebgpix
MouseClick("left", $leavebgposx, $leavebgposy, 2)
$matchesplayed = $matchesplayed + 1
IniWrite("PvP-Bawt-Config.ini", "Matches_Last_Session", "MATCHES_PLAYED", $matchesplayed)
Sleep(10000)
EndIf
if $nonstop = 0 Then
Exit
EndIf
Until $nonstop = 5 
#endregion BGEnter
#region _HPWatch()
MemGetStats($health)=ContinueLoop
If($health=<$healthcrit1, $health>=$healthcrit2) Then
    ControlSend($hpstone down)
    Sleep(100)
    ControlSend($hpstone up)
ElseIf($health<=$healthcrit2, $health>=$healthcrit1) Then
    ControlSend($sac down)
    Sleep(100)
    ControlSend($sac up)
EndIf
#endregion _HPWatch
#region _BG
Select
    Case $bgname = "WSG"
        Sleep("350000")
        Send("e down")
        Sleep("4000")
        Send("e up")
        Send("w down")
        Sleep("20000")
        Send("w up")
        Send("d down")
        Sleep("2000")
        Send("d up")
        Send("w down")
        Sleep("45000")
        Send("e down")
        Sleep("13000")
        Send("e up")
        Send("w up")
        Send("a down")
        Sleep("2000")
        Send("a up")
        Send("w down")
        Sleep("30000")
        Send("w up")
        Send("e down")
        Send("{space} 40")
        Sleep("35000")
        Send("e up")
        Send("w down")
        Sleep("35000")
        Send("a down")
        Sleep("3000")
        Send("a up")
        Sleep("45000")
    Case $bgname = "AB"
    ;Insert Arathi Basin controls here
    Case $bgname= "AV"
    ;Insert AV controls here
EndSelect
#endregion _BG


If $zone <> "bg" Then

And what that does is it is supposed to check the .ini file for the zone the bot will be in this session, then it will determine the value and if it is bg then it will perform the giant function with a whole bunch of if's inside of it. I dont know if you can put an if inside an if, or if there is a work around for that or what, but it gave me an error when I tried to end the if that determined if it was bg (and executing this code) so that I could start up a new if for a new zone.

So what I'm basically asking is how do I get large operations involving many If statements inside of an If statement.

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  
Followers 0