Jump to content
UBot Underground

How to evaluate whether a sub returned true or false


Recommended Posts

Gday..

 

I am trying to do the following in a sub:

- check for various items on a page

- if not present, return false, else return true

 

I have tried to plug the sub into the qualifier part of an if statement, but it always seems to evaluate as true.

 

I also tried setting a variable with the Sub as the input, but Ubot gets an Invalid Cast Exception.

 

The video that's supposed to be on returning from subs is actually about error reporting, so I couldn't find any info there.

 

Hope that makes sense - I can post screenshots.

 

Any help greatly appreciated!

 

Thanks

Link to post
Share on other sites

Yes, you need to run the sub and THEN have the if command see if whatever you want is true.

 

Thanks Hannah,

 

I haven't had a chance to try the suggestions yet, but do you mean I should set a variable with the result from the sub, or put the Run Sub call directly in the If statement's qualifier block?

 

Cheers..

Link to post
Share on other sites

It's late and I am probably doing something dumb, but I am having an issue trying to get past the error in the attachment.

 

I've also tried putting $return value straight into the if qualifier.

 

The contents of the sub being called is exactly the same as the example bluegoat posted above.

 

Any ideas?

 

Thanks!

post-104-1264775224641_thumb.png

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...