Results 1 to 5 of 5

Thread: How does pixel shift work?

  1. #1
    Join Date
    Nov 2011
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default How does pixel shift work?

    I have been reading over MSI's code but I have no idea what averagePixelShift. Could someone please explain exactly how it works?

    Code:
    function MSI_IsAnimating(Anim: TAnimation): Boolean;
    var
      avg: integer;
    begin
      with Anim do
      begin
        avg := averagePixelShift(pixelBox, interval, maxTime);
        result := inRange(avg, minPixelShift, maxPixelShift);
        MSI_SubDebug('Average pixel shift: ' + intToStr(avg));
    
        if (result) then
          MSI_SubDebug('Player animation: ' + anim.name);
      end;
    end;
    ^ Taken from MSI if someone wants to reference it.

  2. #2
    Join Date
    Mar 2007
    Posts
    5,125
    Mentioned
    275 Post(s)
    Quoted
    901 Post(s)

    Default

    {************************************************* ******************************
    function PixelShift(B: TBox; Time: Integer): Integer;
    By: marpis
    Description: Calculates how many pixels change in box B during time T.
    Date: Nov. 29, 2009
    ************************************************** *****************************}

    So what this would do is it would count how many pixels have changed in the box that you set in the time that you set. Used to detect movement in mining,woodcutting ect

  3. #3
    Join Date
    Dec 2007
    Posts
    2,112
    Mentioned
    71 Post(s)
    Quoted
    580 Post(s)

    Default

    im guessing by how it is used there, it calculates an average pixel shift. so it checks pixels at intervals until the max time is reached. it then calculates a average with the results. inrange checks if the average result given by averagepixelshift is in range of maybe the script's values. (minPixelShift, maxPixelShift)

  4. #4
    Join Date
    Mar 2006
    Location
    Behind you
    Posts
    3,193
    Mentioned
    61 Post(s)
    Quoted
    63 Post(s)

    Default

    Moved to scripting help

    "Sometimes User's don't need the Answer spelled out with Code. Sometimes all they need is guidance and explanation of the logic to get where they are going."

  5. #5
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    As your player does various activities, or moves around in RS, your characters pixel turn on/off or "shifts". That function determines how many pixels are being turned on or off during a set amount of time in a given box.
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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