Jump to content

How do I state a Variable in a text box?


Atti
 Share

Recommended Posts

I'm trying to actively put different changing variables into a text box for easy display, and I'm hoping i wont have to write out each possible one instead of just putting variables in it...

For instance:

TrayTip ("Bot Status", "Waiting or Searching for a Target                   $hpp", 100)

Is just saying...

Bot Status

Waiting or Searching for a Target

$hpp

if anyone has suggestions or a way around this, please help!
Link to comment
Share on other sites

Let me explain how this works:

"Text"

The interpreter (AutoIT Core, if you will) reads exactly what's inside there, it doesn't look for stuff to process, just 'reads' it back to the user. What you want to do is break out of this 'reading' and start 'processing', to do this:

$Variable = "Apple Pie!"
"Text" & $Variable

That's just an example, you could also use a function:

"Text" & Func1()

Func Func1()
    Return "Apple Pie!"
EndFunc

Both would have the same result.

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

Post your code?

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

All of it.

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

Ok.. its a bit of a mess since my editplus is being weird.

WinActivate ("World of Warcraft")
sleep(2000)

;Beginning Startup -- Waiting for the rest of the bot to start


$loop = 0
TrayTip("Opening Atti's Rogue Bot", "Welcome to Atti's Rogue Bot!                                                                                                                                                      loading.", 2.5)
Sleep(1300)
TrayTip("Opening Atti's Rogue Bot", "Welcome to Atti's Rogue Bot!                                                                                                                                                      loading..", 2.5)
Sleep(1300)
TrayTip("Opening Atti's Rogue Bot", "Welcome to Atti's Rogue Bot!                                                                                                                                                      loading...", 2.5)
Sleep(1300)
TrayTip("Opening Atti's Rogue Bot", "Welcome to Atti's Rogue Bot!                                                                                                                                                      loading.", 2.5)
Sleep(1300)
TrayTip("Opening Atti's Rogue Bot", "Welcome to Atti's Rogue Bot!                                                                                                                                                      loading..", 2.5)
Sleep(1300)
TrayTip("Opening Atti's Rogue Bot", "Welcome to Atti's Rogue Bot!                                                                                                                                                      loading...", 20.5)
Sleep(1400)

While WinActive ( "World of Warcraft") = 1
; Looping the Current Stats of the Bot
While 1
$hpp = -1
Do
sleep(200)
$hp =PixelGetColor (162, 68)
If $hp >= 40000 then
If $hp <= 60000 then
$hpp = 100
Endif
Endif
$hp =PixelGetColor (154, 68)
If $hp >= 40000 then
If $hp <= 60000 then
$hpp = 90
Endif                            
Endif
$hp =PixelGetColor (146, 68)
If $hp >= 40000 then
If $hp <= 60000 then
$hpp = 80
Endif
Endif
$hp =PixelGetColor (138, 68)
If $hp >= 40000 then
If $hp <= 60000 then
$hpp =70
Endif
Endif
$hp =PixelGetColor (130, 68)
If $hp >= 40000 then
If $hp <= 60000 then
$hpp =60
Endif
Endif
$hp =PixelGetColor (122, 68)
If $hp >= 40000 then
If $hp <= 60000 then
$hpp =50
Endif
Endif
$hp =PixelGetColor (114, 68)
If $hp >= 40000 then
If $hp <= 60000 then
$hpp = 40
Endif
Endif
$hp =PixelGetColor (106, 68)
If $hp >= 40000 then
If $hp <= 60000 then
$hpp = 30
Endif
Endif
$hp =PixelGetColor (98, 68)
If $hp >= 40000 then
If $hp <= 60000 then
$hpp = 20
Endif
Endif
$hp =PixelGetColor (90, 68)
If $hp >= 40000 then
If $hp <= 60000 then
$hpp = 10
Endif
Endif

$hp =PixelGetColor (81, 68)
    If $hp >= 40000 then
        If $hp <= 60000 then
        $hpp = 0
        Endif
    Endif
IniWrite ("TrayInfo.ini", "condition", "hp", "$hpp")
Until $hpp >= 0
Dim $hpp
$hpp =IniRead("TrayInfo.ini", "condition", "hp", 0)
TrayTip ("Bot Status", "Waiting or Searching for a Target" & hpreport($hpp), 100)                  
Wend
$loop = 0
Wend
Func hpreport(Byref $hpp)
    Return "HP: $hpp"
Endfunc
Func Ext() 
    ProcessClose("The Rogue Bot v2.exe") 
    Sleep(100)
    ProcessClose("Autoit3.exe")
    Sleep(100)
    ProcessClose("TrayTip.exe")
    sleep(100)
    FileDelete("TrayInfo.ini")
EndFunc

If you hadn't guessed I'm new to Autoit and still don't really have a feeling for it.

Link to comment
Share on other sites

IniWrite ("TrayInfo.ini", "condition", "hp", "$hpp")

Just take the quotes out, did you read what I said? -.- Change it to this:

IniWrite ("TrayInfo.ini", "condition", "hp", $hpp)

Also, all those if's, no good :lmao: you can get the same accomplished like so:

$hp =PixelGetColor (162, 68)
If $hp >= 40000 AND $hp If $hp <= 60000 then
$hpp = 100
Endif

AND you can see a pattern in those numbers, right? So lets step through each one:

For [b]$i[/b] = 82 to 162 STEP 8
    $hp =PixelGetColor ([b]$i[/b], 68)
    If $hp >= 40000 AND $hp If $hp <= 60000 then
        $hpp = 100
    Endif
Next

I'll be going to bed soon, so please re-read anything if you don't understand it or use the help file.

Edited by Insolence
"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
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...