Jump to content
Sign in to follow this  
DoctorSLO

Problem with If ... elseif ... else

Recommended Posts

DoctorSLO

Hi.

Here is piece of my script:

If $gorjacarjev >= $gorjacar And $paladinov >= $paladin And $metalcev >= $metalec Then
        MsgBox(0, "lol", $gorjacarjev& " >= " &$gorjacar& " in " &$paladinov& " >= " &$paladin& " in " &$metalcev& " >= " &$metalec, 50)
        _IENavigate($ie, "http://speed.travian.si/a2b.php")
        $ngorjacar = _IEGetObjByName($ie, "t1")
        $npaladin = _IEGetObjByName($ie, "t5")
        $nmetalec = _IEGetObjByName($ie, "t3")
        $nx = _IEGetObjByName($ie, "x")
        $ny = _IEGetObjByName($ie, "y")
        _IEFormElementSetValue($ngorjacar, $gorjacar)
        _IEFormElementSetValue($npaladin, $paladin)
        _IEFormElementSetValue($nmetalec, $metalec)
        _IEFormElementSetValue($nx, $x)
        _IEFormElementSetValue($ny, $y)
        $form = _IEFormGetObjByName($ie, "snd")
        _IEFormElementRadioSelect($form, 4, "c")
        $ok = _IEGetObjByName($ie, "s1")
        _IEAction($ok, "click")
        _IELoadWait($ie)
        $send = _IEGetObjByName($ie, "s1")
        _IEAction($send, "click")
        _IELoadWait($ie)
    ElseIf $gorjacarjev2 >= $gorjacar2 Then
        MsgBox(0, "Lol", "dvojka "&$gorjacarjev2&" >= "&$gorjacar2, 50)
        _IENavigate($ie, "http://speed.travian.si/a2b.php")
        $ngorjacar = _IEGetObjByName($ie, "t1")
        $nx = _IEGetObjByName($ie, "x")
        $ny = _IEGetObjByName($ie, "y")
        _IEFormElementSetValue($ngorjacar, $gorjacar2)
        _IEFormElementSetValue($nx, $x)
        _IEFormElementSetValue($ny, $y)
        $form = _IEFormGetObjByName($ie, "snd")
        _IEFormElementRadioSelect($form, 4, "c")
        $ok = _IEGetObjByName($ie, "s1")
        _IEAction($ok, "click")
        _IELoadWait($ie)
        $send = _IEGetObjByName($ie, "s1")
        _IEAction($send, "click")
        _IELoadWait($ie)
    ElseIf $paladinov2 >= $paladin2 Then
        MsgBox(0, "Lol", "trojka "&$paladinov2&" >= "&$paladin2, 50)
        _IENavigate($ie, "http://speed.travian.si/a2b.php")
        $npaladin = _IEGetObjByName($ie, "t5")
        $nx = _IEGetObjByName($ie, "x")
        $ny = _IEGetObjByName($ie, "y")
        _IEFormElementSetValue($npaladin, $paladin2)
        _IEFormElementSetValue($nx, $x)
        _IEFormElementSetValue($ny, $y)
        $form = _IEFormGetObjByName($ie, "snd")
        _IEFormElementRadioSelect($form, 4, "c")
        $ok = _IEGetObjByName($ie, "s1")
        _IEAction($ok, "click")
        _IELoadWait($ie)
        $send = _IEGetObjByName($ie, "s1")
        _IEAction($send, "click")
        _IELoadWait($ie)
    ElseIf $metalcev2 >= $metalec2 Then
        MsgBox(0, "Lol", "sterka "&$metalcev2&" >= "&$metalec2, 50)
        _IENavigate($ie, "http://speed.travian.si/a2b.php")
        $nmetalec = _IEGetObjByName($ie, "t3")
        $nx = _IEGetObjByName($ie, "x")
        $ny = _IEGetObjByName($ie, "y")
        _IEFormElementSetValue($nmetalec, $metalec2)
        _IEFormElementSetValue($nx, $x)
        _IEFormElementSetValue($ny, $y)
        $form = _IEFormGetObjByName($ie, "snd")
        _IEFormElementRadioSelect($form, 4, "c")
        $ok = _IEGetObjByName($ie, "s1")
        _IEAction($ok, "click")
        _IELoadWait($ie)
        $send = _IEGetObjByName($ie, "s1")
        _IEAction($send, "click")
        _IELoadWait($ie)
    Else 
        MsgBox(0, "lol", "sleep", 50)
        Sleep(60000)
    EndIfoÝ÷ Ù8^¦ºé¢²)í+%w¬[7ê
+§®7¯Ú

Please I need help ... if you dont understand something just ask ... thx

Share this post


Link to post
Share on other sites
Jos

"6" is bigger than "10"

So likely you are comparing strings in stead on numbers.

Use Number() to convert them.

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
CodyBarrett

... maybe its getting "1" from each and it "=" eachothers... say you get 1 when something is true... and 0 when its false.

Share this post


Link to post
Share on other sites
DoctorSLO

Huh, I see now :o

I have numbers in strings, I used now Number() and it works ..

Thanks Jos :D

Share this post


Link to post
Share on other sites
Jos

... maybe its getting "1" from each and it "=" eachothers... say you get 1 when something is true... and 0 when its false.

Could you run this by us again but this time slowly? :D

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
CodyBarrett

im not uhh.. familliar with IE commands.. so PROBABLY i am wrong but what i was saying was maybe its the function status that its checking and not the value.. say the function is true then it would be 1 false it would be 0 or another value...

never mind ill learn more areas of autoit haha

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.