Sign in to follow this  
Followers 0
no_messiah

Whiles not ending after wend?

5 posts in this topic

allright i made this small script for lvling some skill so my danm fingers wouldent fall off from pressing keys but it not quite working as inteded its surposed to calc maxium posible cast baed on spell mana and spell cost and then cast x number of times it does that fine now its time to recharge the mana and cast again it use a calculation more here based on max mana devided but the mana i can recharge per meditation really simple script problem is when it has recharged mana once it starts to cast spell once more :) take a look at the code and tell me where i go wrong

;Gobal settings and vars
Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
$sitkey = IniRead("Config.ini", "Config data", "sitkey", "")
$medikey = IniRead("Config.ini", "Config data", "medikey", "")
$spellkey = IniRead("Config.ini", "Config data", "spellkey", "")
$maxmana = IniRead("Config.ini", "Config data", "maxmana", "")
$medirecharge = IniRead("Config.ini", "Config data", "medirecharge", "")
$spellcost = IniRead("Config.ini", "Config data", "spellcost", "")
$meditime = IniRead("Config.ini", "Config data", "meditime", "13000")
$medimaxround = Round(Number($maxmana/$medirecharge), 0)
$medimaxnoround = Round(Number($maxmana/$medirecharge), 1)
$castmax = Round(Number($maxmana/$spellcost), 0)
$cast = 0
$medi = 0

If Number($medimaxnoround-$medimaxround) > 0 Then
$medimax = $medimaxround + 1
Call ("start")
EndIf   

Func start ()
If WinExists ("[Conquer]", "") Then
    WinActivate("[Conquer]", "")
    Sleep ("5000")
    Call ("Caster")
Else
    MsgBox(4096, "Spell Caster", "Conquer window not found the box will exit in 5 sec", 5)
EndIf
EndFunc

Func Caster ()
    Send($spellkey)
    While 1
        MouseClick("right", 500, 320, 1)
        sleep ("1000")
        $cast = $cast + 1
        If $cast <= $castmax Then ExitLoop
    WEnd
    Call ("Resetmedi")
EndFunc

Func Medi ()
    While 1
        Send($sitkey)
        Sleep ("$meditime")
        Send($medikey)
        Sleep ("250")
        $medi = $medi + 1
        If $medi <= $medimax Then ExitLoop
    WEnd
    Call ("Resetcast")
EndFunc

Func Resetcast ()
    $cast = 0
    Call ("Caster")
EndFunc

Func Resetmedi ()
    $medi = 0
    Call ("Medi")
EndFunc



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

Func Terminate()
    Exit 0
EndFunc

Share this post


Link to post
Share on other sites

#2 ·  Posted (edited)

allright i made this small script for lvling some skill so my danm fingers wouldent fall off from pressing keys but it not quite working as inteded its surposed to calc maxium posible cast baed on spell mana and spell cost and then cast x number of times it does that fine now its time to recharge the mana and cast again it use a calculation more here based on max mana devided but the mana i can recharge per meditation really simple script problem is when it has recharged mana once it starts to cast spell once more :) take a look at the code and tell me where i go wrong

<{POST_SNAPBACK}>

Your functions all end with calling another function!!!! so they never end.

To return to the previous function use Return.

Edited by JdeB

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

Your functions all end with calling another function!!!! so they never end.

To return to the previous function use Return.

<{POST_SNAPBACK}>

lol i never though of that thats why i am getting overflows right?

well how would u go about changing it? i need som advice to make it right

Share this post


Link to post
Share on other sites

lol i never though of that thats why i am getting overflows right?

<{POST_SNAPBACK}>

Correct..

well how would u go about changing it? i need som advice to make it right

<{POST_SNAPBACK}>

example:

$a = 1
$b = F1($a)
MsgBox(0, 'test', $b)

Func F1($x)
    $x = $x + 1
    $x = F2($x)
    Return $x
EndFunc  ;==>F1

Func F2($y)
    Return $y / 2
EndFunc  ;==>F2

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

Correct.. 

example:

$a = 1
$b = F1($a)
MsgBox(0, 'test', $b)

Func F1($x)
    $x = $x + 1
    $x = F2($x)
    Return $x
EndFunc  ;==>F1

Func F2($y)
    Return $y / 2
EndFunc  ;==>F2

<{POST_SNAPBACK}>

hmm still dont get return but i changed the script to this it still have same error though :D

;Gobal settings and vars
Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
$sitkey = IniRead("Config.ini", "Config data", "sitkey", "")
$medikey = IniRead("Config.ini", "Config data", "medikey", "")
$spellkey = IniRead("Config.ini", "Config data", "spellkey", "")
$maxmana = IniRead("Config.ini", "Config data", "maxmana", "")
$medirecharge = IniRead("Config.ini", "Config data", "medirecharge", "")
$spellcost = IniRead("Config.ini", "Config data", "spellcost", "")
$spelltimer = IniRead("Config.ini", "Config data", "spelltimer", "")
$meditime = IniRead("Config.ini", "Config data", "meditime", "10000")
$medimaxround = Round(Number($maxmana/$medirecharge), 0)
$medimaxnoround = Round(Number($maxmana/$medirecharge), 1)
$castmaxround = Round(Number($maxmana/$spellcost), 0)
$castmaxnoround = Round(Number($maxmana/$spellcost), 1)
$cast = 0

If WinExists ("[Conquer]", "") Then
    WinActivate("[Conquer]", "")
    Sleep ("5000")
    If Number($medimaxnoround-$medimaxround) > 0 Then
        $medimax = $medimaxround + 1
    Else
        $medimax = $medimaxround
    EndIf
        If Number($castmaxnoround-$castmaxround) >= 0.5 Then
        $castmax = $castmaxround - 1
    Else
        $castmax = $castmaxround
    EndIf
    $medi = $medimax
    While 1
        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
        ;medipart
            Send($sitkey)
            Sleep ("$meditime")
            Send($medikey)
            Sleep ("250")
            $medi = $medi + 1
            If $medi = $medimax Then $cast = 0
        EndIf
    WEnd
Else
    MsgBox(4096, "Spell Caster", "Conquer window not found the box will exit in 5 sec", 5)
EndIf


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

Func Terminate()
    Exit 0
EndFunc

still doesent stop casting the first part :)

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