Jump to content
Sign in to follow this  
no_messiah

Odd while behavior

Recommended Posts

hi there i am still having some problem with my script i commented the code and changed it abit but i stil can figure out where i go wrong :D

;Gobal settings and vars
Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
;hotkey to sit down
$sitkey = IniRead("Config.ini", "Config data", "sitkey", "")
;hotkey to meditation
$medikey = IniRead("Config.ini", "Config data", "medikey", "")
;hotkey to spell that needs lvling
$spellkey = IniRead("Config.ini", "Config data", "spellkey", "")
;maxium amount of mana
$maxmana = IniRead("Config.ini", "Config data", "maxmana", "")
;amount of mana recharged per time meditation is preformed
$medirecharge = IniRead("Config.ini", "Config data", "medirecharge", "")
;cost of the spell that need lvling
$spellcost = IniRead("Config.ini", "Config data", "spellcost", "")
;timer before spell can be recasted
$spelltimer = IniRead("Config.ini", "Config data", "spelltimer", "")
;time to sit down before meditation can be casted
$meditime = IniRead("Config.ini", "Config data", "meditime", "10000")
;maxium times meditation need casted rounded off with 0 digets
$medimaxround = Round(Number($maxmana/$medirecharge), 0)
;maxium times meditation need casted rounded off with 1 digets
$medimaxnoround = Round(Number($maxmana/$medirecharge), 1)
;maxium times spell can be casted rounded off with 0 digets
$castmaxround = Round(Number($maxmana/$spellcost), 0)
;maxium times spell can be casted rounded off with 1 digets
$castmaxnoround = Round(Number($maxmana/$spellcost), 1)
;define the cast number at 0 so the script knows the it can start casting
$cast = 0

;first i chek for the window and if its there i activate it and sleep 5 secs
If WinExists ("[Conquer]", "") Then
    WinActivate("[Conquer]", "")
    Sleep ("5000")
;calculates if if the mana needs to berecharged an extra time to do rounding down
    If Number($medimaxnoround-$medimaxround) > 0 Then
        $medimax = $medimaxround + 1
    Else
        $medimax = $medimaxround
    EndIf
;sets the medi count at max forstarting so it doesent start with a recharge
    $medi = $medimax
;calculates if the max cast counts is rounded up or down and then corrects the number of times to cast
    If Number($castmaxnoround-$castmaxround) >= 0.5 Then
        $castmax = $castmaxround - 1
    Else
        $castmax = $castmaxround
    EndIf
;the loop where the casting and the recharging takes place
    While 1
    ; first if medi=medimax then there no need for more recharging then casting can start and when cast = castmax then it set medi at 0
        If $medi = $medimax Then
        ;castpart
            Send($spellkey)
            Sleep ("250")
            MouseClick("right", 500, 320, 1)
            sleep ($spelltimer)
            $cast = $cast + 1
            If $cast = $castmax Then $medi = 0
        Else
        ;here if the medi = 0 it should rund the medi script and keep adding 1 until medi = medimax and then the script should rund the casting part again
        ;medipart
            Send($sitkey)
            Sleep ("$meditime")
            Send($medikey)
            Sleep ("250")
            $medi = $medi + 1
            If $medi = $medimax Then $cast = 0
        EndIf
    WEnd
Else
;else quite script and display box the game was not active
    MsgBox(4096, "Spell Caster", "Conquer window not found the box will exit in 5 sec", 5)
EndIf

;pause function
Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

;terminate function
Func Terminate()
    Exit 0
EndFunc

pls ask if you dont understand what a part of the code is there for i will try exlpain what i have though with it :)

Share this post


Link to post
Share on other sites

hi there i am still having some problem with my script i commented the code and changed it abit but i stil can figure out where i go wrong  :)

;the loop where the casting and the recharging takes place
    While 1
    ; first if medi=medimax then there no need for more recharging then casting can start and when cast = castmax then it set medi at 0
        If $medi = $medimax Then
        ;castpart
            Send($spellkey)
            Sleep ("250")
            MouseClick("right", 500, 320, 1)
            sleep ($spelltimer)
            $cast = $cast + 1
            If $cast = $castmax Then $medi = 0
        Else
        ;here if the medi = 0 it should rund the medi script and keep adding 1 until medi = medimax and then the script should rund the casting part again
        ;medipart
            Send($sitkey)
            Sleep ("$meditime")
            Send($medikey)
            Sleep ("250")
            $medi = $medi + 1
            If $medi = $medimax Then $cast = 0
        EndIf
    WEnd

<{POST_SNAPBACK}>

Hint: What happens when $Cast is greater than $CastMax, or when $Medi is greater than $MediMax?

Phillip

Share this post


Link to post
Share on other sites

Hint: What happens when $Cast is greater than $CastMax, or when $Medi is greater than $MediMax?

<{POST_SNAPBACK}>

lol u genius bastard i could kiss ya :) tyty

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...