Difference between revisions of "Shift right"

From WikiManual
Jump to: navigation, search
Line 9: Line 9:
 
== Possible uses ==
 
== Possible uses ==
  
  -1 .shoot 1 *.refeye *.myeye sub ^ mult store
+
  -1 .shoot 1 *.refeye *.myeye sub >> mult store
  
 
Will shoot whenever *.refeye and *.myeye are not equal.
 
Will shoot whenever *.refeye and *.myeye are not equal.
  
  100 .aimsx 1 *.eye5 ^ mult store
+
  100 .aimsx 1 *.eye5 >> mult store
  
 
Will turn only when there isn't anything on focus.
 
Will turn only when there isn't anything on focus.

Revision as of 13:02, 11 August 2007

Picks the last two numbers in the stack and shifts right the first one's bits the amount specified by the second one.

Shifting 1 by x returns zero unless x is 0.

Shifting -1 by x always returns -1.

Shifting x by 1, when x is positive, always returns the absolute value of x 2 div.

Possible uses

-1 .shoot 1 *.refeye *.myeye sub >> mult store

Will shoot whenever *.refeye and *.myeye are not equal.

100 .aimsx 1 *.eye5 >> mult store

Will turn only when there isn't anything on focus.