Jump to content
UBot Underground

[SOLVED] Subtract the sum of 2 variables


Recommended Posts

Hi guys - ran into an issue that is throwing errors and hope someone can help me get on track.

 

 

Here's the jist of it.

 

1- scrape page for certain number

2- save number into var

 

3- some code executes that 'should' change the number i originally scraped. (but doesnt always change the number).

 

4- scrape page for same certain number

5- save to different variable

 

6- set

new var

var2 - var1 = var3

 

7-create var4

 

8- var 3 is set as var4

9- var4 is used in ui monitor

 

The error i'm getting is: Cannot subtract 2 strings

 

 

Basically its like this:

 

scrape a number - do stuff for the number to increase - saved to var

do the same again and save to different var (because its a different number)

subtract 1 var from another var to get the difference.

display the difference.

 

its working - its returning the number as expected... but its also throwing that error.

Link to post
Share on other sites

Most likely there is some other junk in the strings than just numbers. have you stepped through using the debugger and checked the variables at each step?

Link to post
Share on other sites

sure have man - only "junk" would possibly be a comma ... 208,416

 

Update - Yes. Removed the comma and all works as expected. - Thanks man!

Link to post
Share on other sites

:)

 

Well, if you REALLY need a comma (as a comma in numbers), then you need to keep in mind that UBot Studio is built by americans for americans. They use dot for comma there, most parts of the rest of the world do not. Where I live, comma in numbers means comma, while the dot is used for separating thousands in numbers. In the american world it's the opposite. Just look at dates. A date in UBot Studio is on the form MM/DD/YYYY while in my part of the world it's YYYY-MM-DD (which, by the way, makes it a lot easier to sort) .Another thing is the use of the AltGr-key. That didn't work before, now it do after I sent a European keyboard to Eddie so that he could get a grip on how it's used over here. It would be great if UBot was localizeable, it's not. We just have to live with it.  If I scrape decimal numbers, I always have to do a string substitute on it to convert the dot into a comma otherwise Javascript won't work. It's just the way it is.

 

(in your case I am uncertain whether it was a comma as in decimal comma, or a comma as in thousand separator that caused the problem)

 

 

Great that it worked!

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