Jump to content
UBot Underground

Check if a variable is empty?


Recommended Posts

This seems like it should be so simple but for some reason it's not working.

 

I need to do this:

 

if

#var is empty

do something

 

I've tried doing an eval for $nothing but it doesn't work. I also can't have it eval for an empty string, because UBot always puts ( ) in the string if it's blank.

 

What am I doing wrong here?

 

Thanks,

 

Jonathan

Link to post
Share on other sites

OK this gets stranger... it works fine when and ONLY when the value I'm testing for is the first item in the list. Subsequent items, even though they are identical, fail to evaluate.

 

So if I have it evaluating a list for #var being equal to a hyphen, if the first value is a hyphen then that one will work. But the next value could be a hyphen as well, and it won't evaluate even though the value is in fact a hyphen and I can use it as I would expect in any other way.

 

What gives?

 

Jonathan

Link to post
Share on other sites

WTF... I swear I'm losing my mind. What's actually happening is UBot is jumping right over items in a loop. No idea why! The loop in question is attached. Take a look at it... UBot executes the js alert properly on the first loop, and after that it blows right past it skipping both the alert and the IF logic completely and moving right on past them.

 

WHat on earth is going on here?

 

Jonathan

 

post-271-12637668686851_thumb.png

Link to post
Share on other sites

Thanks that's worth a try... but the issue actually isn't the comparison, it's the fact that UBot is completely skipping over entire nodes on the loop. They work on the first pass, and then they ignore it completely.

 

Seems like a bug but I'm hoping I'm wrong...

 

Jonathan

Link to post
Share on other sites

More info.. the problem is in the run javascript node. If I have it display an alert consisting of a variable, it only works on the first pass of the loop. But if I set it to display an alert consisting of a string, it loops just fine every time.

 

More and more this is feeling like a bug.

 

Jonathan

Link to post
Share on other sites

More info.. the problem is in the run javascript node. If I have it display an alert consisting of a variable, it only works on the first pass of the loop. But if I set it to display an alert consisting of a string, it loops just fine every time.

 

More and more this is feeling like a bug.

 

Jonathan

can you send me the bot?

Link to post
Share on other sites

hey sorry. I've been looking at this and I figured out what the problem is... sort of. when list from text splits up the text, for some reason it's keeping a line break at the beginning of every line but the first. what that means is that when it tried the javascript, it ends up looking something like this:

 

alert('

line2');

 

which doesn't make sense to the browser. I'll have to do some more head scratching to come up with an elegant solution to the problem, but its on my list and I'll do everything I can to include it in the next update (which I promise will happen in the next few days. sorry guys, been busy with the affiliate system!)

Link to post
Share on other sites

Aha! OK so at least it's a confirmed bug and I'm not just completely losing my mind. LOL

 

OK I'll be patient... for the time being I have a semi-solution cooked up in strict PHP but the UBot solution would be a bit more elegant.

 

Thanks Seth!

 

Jonathan

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...