Sign in to follow this  
Followers 0
t0ddie

help with an "or" function

3 posts in this topic

#1 ·  Posted (edited)

i want to do this

HotKeySet("1", "one")

HotKeySet("2", "two")

HotKeySet("3", "three")

$away = 0

Do

sleep(500)

Until $away = 1 or 2 or 3

func one()

$away = 1

endfunc

func two()

$away = 2

endfunc

func three()

$away = 3

endfunc

but this doesnt work. "or" isnt working like i thought it would.

well, i have this script, and it works fine

this is just a test script i wrote up quick to test functionality. my problem is i need to use the "=" operator.

HotKeySet("1", "one")

HotKeySet("2", "two")

HotKeySet("3", "three")

$away = 0

Do

sleep(500)

Until $away <> 0

func one()

$away = 1

endfunc

func two()

$away = 2

endfunc

func three()

$away = 3

endfunc

the script just runs until you press "1", "2" or "3".

the problem lies in the actual script im writing, and not this test script.

their are many different values that "$away" could be, and i want to check the variable against a few set values, and not against a bajillion different values.

i have this code in a "do" "until" loop, and i want it to loop until one of the 3 set values matches the variable "$away"

so if its 1, or 2 or 3... then continue, but anything other than that, keep looping.

is there a better way to do this? thanks

Todd

EDIT: i just posted, but im going to try to put the numbers in as strings. i think that may be the problem, LOL

Until $away = "1" or "2" or "3"

EDIT2: nope that didnt work, but it was worth a shot. alot of times i figure out the answer right after i post, lol. but not this time

still broke.

Edited by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites



Until $away = "1" or "2" or "3"

EDIT2: nope that didnt work, but it was worth a shot. alot of times i figure out the answer  right after i post, lol. but not this time

still broke.

<{POST_SNAPBACK}>

Until $away = "1" or $away = "2" or $away = "3"

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

Share this post


Link to post
Share on other sites

i was on the right track,

thanks jdeb!

i already knew you could do this with "or" but i always used it for seperate variables.

Until $away = 1 or $here = 1 or $there = 1

this time the values were different.

Until $away = 1 or $away = 2 or $away = 3

and yep, it works fine without the quotes around the numbers, since these arent strings.

brilliant


Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

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