Sign in to follow this  
Followers 0
Bigglesw0rth

if/then issue with a Variable.

7 posts in this topic

#1 ·  Posted (edited)

So I have a simple array and function and an ifthen routine.

Dim $var[2] = ['1153', '559']

Trainer($var[0], $var[1], 1)

Func FirstFunc($arm1, $arm2, $Other)

    If $arm2 = 558 or 662 or 766 Then
        MouseClick("Left", 1241, 744, 1, 10)
        TrayTip('What', 'Err Test' & $arm2, 3)
    else
        MouseClick("Left", 1241, 530, 1, 10)
        TrayTip('What', 'NORM', 3)
    EndIf
endfunc

When I run this, my traytip tells me that the value of $arm2 is 559. This is correct, however, ir order for the traytip to even trigger, the value needed to be either 558, 662 or 766. What gives? Why isnt the 'else' values triggering instead?

Edited by Bigglesw0rth

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Global $var[2] = [1153, 558]
FirstFunc($var[0], $var[1], 1)

$var[1] = 662
FirstFunc($var[0], $var[1], 1)

$var[1] = 766
FirstFunc($var[0], $var[1], 1)

$var[1] = 599
FirstFunc($var[0], $var[1], 1)

Func FirstFunc($arm1, $arm2, $Other)
    If ($arm2 = 558) Or ($arm2 = 662) Or ($arm2 = 766) Then
        MouseClick("Left", 1241, 744, 1, 10)
        TrayTip("What", "Err Test" & $arm2, 3, 3)
        Sleep(1000) ; had to do this to make it stick, you may not have to
    Else
        MouseClick("Left", 1241, 530, 1, 10)
        TrayTip("What", "NORM", 3)
        Sleep(1000) ; had to do this to make it stick, you may not have to
    EndIf
EndFunc   ;==>FirstFunc

Edited by LaCastiglione

Share this post


Link to post
Share on other sites

Replace the line with:

If $arm2 = 558 or $arm2 = 662 or $arm2 = 766 Then

Your code wasn't enough to play with, so I did my own testing and leaving out the "$arm2 =" messed up the functionality. I am a bit puzzled by the results otherwise. But this should work for you.


#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Is this the game bot again?

Dim $Warrior[2] = ['1153', '559']

Trainer($Warrior[0], $Warrior[1], 1)

Func Trainer($arm1, $arm2, $Citynumber)

    If $arm2 = 558 or 662 or 766 Then
        MouseClick("Left", 1241, 744, 1, 10)
        TrayTip('What', 'Alt Troops' & $arm2, 3)
    else
        MouseClick("Left", 1241, 530, 1, 10)
        TrayTip('What', 'NORM', 3)
    EndIf
endfunc

...

Do not discuss any of the following:

Automating games or game servers. See below for more details.

...

Are you stupid or just ignorant ? Edited by Maffe811

[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

Share this post


Link to post
Share on other sites

Maffe811, I did not catch that this was a thread reopening a closed topic. I looked at Bigglesw0rth's history and I can see why he started this one. It was something that PsaltyDS said:

You could have easily created a demo that didn't use tags like "warrior" and "trainer", but you didn't.

So, from that comment, his logical progression would be to change the code to not include such words.

Anyways, I'm outta here. I got stuff to do...


#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

Yup!

Thought i give everyone a headsup.


[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

Share this post


Link to post
Share on other sites

@Bigglesw0rth, lets stop thin now....

@Maffe811, just report it and don't go into a discussion pls, this only leads to escalations we don't need.

thanks

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0