I am not AppleScript literate, so if someone could please help me with this little script I wrote for "ircle", the program I use for IRC
tell application "ircle 3.1 Am. English Carbon"
set ch to currenttarget
set n to numberofusers of ch
set counter to (???)
set u to nickname of user counter of ch
set obj to argstring
if obj = "" then
set obj to "a large trout"
end if
do "/me smacks " & u & " around a bit with " & obj
end tell
I want the script to choose a random user. "n" is the number of users in the selected channel. What do I need to set "counter" to if I want a random integer between 1 and "n"?
try:
set counter to (1 thru n)
It didn't work. Got the syntax error message "a thru:n can't go after this 1"
anyone else?
edit: proper syntax is
set counter to integers 1 thru n
but that's not what I want. I want counter to be ONE integer BETWEEN 1 and n
another edit:
I also tried
set counter to integer is less than n
returned the error "can't make integer into a number, date, or text
set counter to (random number from 1 to n)
Hell yes man, that totally worked
Thanks a bunch. ^_^