Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Repeat Wait until value isn't empty?

Asked by 7 years ago

So I have a stringvalue, and I don't want the script to move on until that value isn't blank. the stringvalue is called winner. I have:

msg.Value = "Game in Progress" until winner ~= "" or " "

It's in a while true do loop.

1 answer

Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
7 years ago
Edited 7 years ago

Syntax for repeat loops is like this:

repeat [code] until [conditions]

To use it to your advantage, you would do:

msg.Value = "Game in Progress"

repeat wait() until winner ~= "" and winner ~= " "

_______________________________________________________________________________

remember: compound conditions with mutual values still require the value's reference for each condition. Moreover, until winner ~= "" or " " should be: until winner ~= "" and winner ~= " "

_______________________________________________________________________________


You can also use the # operator, which returns the length of the given array or string.

Use this to determine if 'winner' isn't a blank string.

msg.Value = "Game in Progress"

repeat wait() until #winner > 0
Ad

Answer this question