Jump to content

Detecting change of an integer's value


Ace

Recommended Posts

Hey,

 

I'm trying to figuring out how I could best detect the change of an integer's value. In the GWD there are widgets for the current kill count and what I'm trying to do is parse the message of the widget to an integer and then detect when this integer increases so you can get a pretty accurate kill counter. 

Do you guys have any ideas of how to detect if an integer has increased in its value? Any help is greatly appreciated! :)

Link to comment
Share on other sites

It's probably not gonna be easy to have it do a callback to some listener; so your only options are something to have asynchronous checks on the value, or just check it in onloop as kevzilla suggested

Alright, I've already tried what kevzilla suggested and I think I'm thinking too far. So the current kill count is always the widget text and how would I define the old/new one so I can compare them?

Link to comment
Share on other sites

Alright, I've already tried what kevzilla suggested and I think I'm thinking too far. So the current kill count is always the widget text and how would I define the old/new one so I can compare them?

 

uh.. you define the old one the same was as you would the new one. You only really need one variable

 

Alternatively, it might be possible to do it async using a config listener

 

  • Like 1
Link to comment
Share on other sites

Yes in the onLoop or a thread. no since you compare the values before you move the current value into the class variable.

okay I got it working so that it counts correctly but the thing is that the counter starts not at 0 but at the number that the widget is showing. So for example: You start the script and in GWD you already have 50 kill count, so the script starts to count at 50 instead of 0. And once you leave the GWD the kill count will be reset

Link to comment
Share on other sites

use 2 variables startAmount, currentAmount.

 

state the startAmount when you start.

currentAmount should be what you have now

 

then to get the right amount of stuff do.

 

Real amount - currentAmount - startAmount = real amount tracked

 

 

Edited by Joseph
  • Like 2
Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...