Jump to content
Sign in to follow this  
hart

if..then problem

Recommended Posts

hart

if $monselect > 0 Then
    attack()
elseif $monselect = 0 then
    findmon()
Else
    ...
endif

when elseif executes, it tries to find monsters by sending a key which is findmon(). the problem is when it finds no monsters, elseif will be triggered again. so i want it to go to else block if it finds no monsters. what should i add?

any tip will be fine. i really had a hard time searching for solutions for this and i'm new to autoit.

Share this post


Link to post
Share on other sites
Authenticity

Use Select...Case...EndSelect structure and use the ContinueCase if the result of the function is something.

Share this post


Link to post
Share on other sites
hart

thx i'll try this. i used this block for my skill. btw i tried exitloop with do.. findmon().. until with that code i dn't know why it exits my main function.

this how my code should look like. my whole func stops at exitloop, shoudn't it be the do loop that will stop?

func x()
while 1
...
if..then...
elseif
do...
   if.. exitloop
..
..
..
Edited by hart

Share this post


Link to post
Share on other sites
Authenticity

It's difficult to understand what is what in this snippet.

Anyway, the generic structure should be a loop like Do...Until <something true> so if this loop is within a loop, exiting this loop would continue with the outer loop, if there is no outer loop it will continue with the execution of the code chart flow which may be nothing. Give a more descriptive, even one that generate errors, just to see the way you coded it.

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.