Other How to return value every time it changes?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: How to return value every time it changes?

  1. #1
    Join Date
    Apr 2012
    Posts
    2

    How to return value every time it changes?

    Hi, I have to use lua.

    I want to print the value at 0x80000048 everytime it is written to!

    My basic code is like this. But I don't want to continually print the value when it is not changing!

    I only want to print that value when it is written to (when it changes)!

    How to do this? Hope you can help!!

    Code:
    l = 0;
     while l < 1000 do
    print(memory.readdword(0x80000048));
          l = l + 1;
       end

  2. #2
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,871

    Re: How to return value every time it changes?

    Create a variable to store the previous value. Then compare. Each time it's different, output and save the current value to the stored variable.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Apr 2012
    Posts
    2

    Re: How to return value every time it changes?

    Unfortunately sometimes the same value will be written.

    Eg. The event is someone rolling a dice. They may roll a 6 and then a 6.

    I will need it to show both 6's!

  4. #4
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,871

    Re: How to return value every time it changes?

    Well...that completely contradicts what you said in your first post.
    Quote Originally Posted by AmateurGuru View Post
    But I don't want to continually print the value when it is not changing!
    Perhaps you should clarify yourself a little more.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center