Firstly, fix the two errors that Chris stated above, but it's likely that the actual method has an issue.
Secondly, grab your wildy level outside of the loop (no need to repeatedly call it when chances are that your wildy level will not change in the span of < 50ms).
Thirdly, I would recommend making this into a method like shouldLogOut(), instead of having your log outs inside of a loop like that.
Fourthly, it should be easy to remake that method if it's giving you problems (issue a bug report though, is my recommendation). Check if the widget displaying the wilderness level is there, and if it is and it's visible, that means that you're in the wilderness (so otherwise return 0). From there, parse the text from the widget and you'll get the wildy level