[C#] Simple Question

03/29/2015 17:02 iCraziE#1
So im reading the memory, getting a value that is consistently changing and storing it in a variable, converting it to a string and displaying it for me to read.

This works fine, it displays the correct value whenever it changes.

My problem is this, I want to check if that value is decreasing or increasing.

Ive searched for an answer to this but everything I see only shows how to check if a value is decreasing/increasing if you manually set the value in the beginning and then do some work to change it.. My case is different because my value is never set by me, it is found outside of my program.

Any help or tips appreciated
03/29/2015 19:27 Epanias#2
Why don't you just save it in a variable, wait for some time and than save it in another variable and check if it increased/decreased?

Pseudocode:
Code:
int Var1 = YourMemoryReader.ReadInt();

System.Threading.Thread.Sleep(/*amount of time*/);

int Var2 = YourMemoryReader.ReadInt();

if (Var1 < Var2)
{
//has increased
}
else if (Var1 > Var2)
{
//has decreased
}
else
{
//still the same
}
03/30/2015 21:47 berkay2578#3
declare an array, store the old in ar[0] new one in ar[1]. so it will be:

Code:
//-->Form() ar[0] & ar[1] = 0

void(){
ar[0] = ar[1]
ar[1] = Read();
//do stuff until the text output to UI
if (ar[0] < ar[1]){//increased (will always increase on first time)}
else if(ar[1] < ar[0]){//decreased}
}