How do you set a repeat to meet 2 conditions?

the dialog below check to see if a buddy exists, and then if they are offline. the script would crash is the buddy name was spelled wrong. So, I made a loop that repeats the dialog until that buddy exists. Well, I cannot continue on with the rest of my script unless the buddy is online. So, I made another loop to repeat until you type in a name of an online buddy. That is where the problem is. If i spell a name incorrectly here, it will error, becuase it is trying to get the status of a non-existant buddy. So, here is my question… is there a way to check for the budd and status at the same time? OR…is there a way to make sure the script does not crash when the wrong name is typed into the get status dialog?

 tell application "iChat"
	set firstBuddy to name of first account
	
	set myAnswer to the text returned of (display dialog "Who do you want to chat with?" default answer firstBuddy)
	repeat until account myAnswer exists
		set myAnswer to the text returned of (display dialog "That is not a buddy name" default answer firstBuddy)
	end repeat
	repeat until status of account myAnswer is not offline
		set myAnswer to the text returned of (display dialog "They are offline at this time" default answer firstBuddy)
	end repeat
end tell

A repeat can use and/or:

set x to 5
set y to 0

repeat until (x > 10) and (y > 10)
	set x to x + 1
	set y to y + 1
end repeat

return "x:" & x & ", y:" & y
--> "x:16, y:11"

However, I’m not sure if I understand you’re script. Perhaps you’re looking for something like this:

tell application "iChat"
	activate
	set myBuddy to name of first account
	set myMessage to "Who do you want to chat with?"
	
	repeat
		display dialog myMessage default answer myBuddy
		set myBuddy to text returned of result
		
		if account myBuddy exists then
			if status of account myBuddy is not offline then
				exit repeat
			else
				set myMessage to """ & myBuddy & "" is currently offline."
			end if
		else
			set myMessage to """ & myBuddy & "" is not a buddy name."
		end if
	end repeat
end tell

Thanks!!!