home *** CD-ROM | disk | FTP | other *** search
Wrap
global TheKeys:P function KeyIsDown KeyCode if KeyCode = "?" then return "KeyIsDown, a simple solution to one of the things that apple left out of HyperCard. Syntax: KeyIsDown <<keyCode>> result:True or false" put NewPtr(32) into TheKeys GetKeys theKeys@ get GetBit(KeyCode) disposPtr TheKeys return (it=1) end KeyIsDown function GetBit bit get bit put it div 8 into TheByte put it mod 8 into TheBit put TheKeys@.charType[TheByte] into h put CharToNum(h) into j if j ≥ 128 then put 1 before ggg subtract 128 from j else put 0 before ggg if j ≥ 64 then put 1 before ggg subtract 64 from j else put 0 before ggg if j ≥ 32 then put 1 before ggg subtract 32 from j else put 0 before ggg if j ≥ 16 then put 1 before ggg subtract 16 from j else put 0 before ggg if j ≥ 8 then put 1 before ggg subtract 8 from j else put 0 before ggg if j ≥ 4 then put 1 before ggg subtract 4 from j else put 0 before ggg if j ≥ 2 then put 1 before ggg subtract 2 from j else put 0 before ggg if j ≥ 1 then put 1 before ggg subtract 1 from j else put 0 before ggg return char TheBit+1 of ggg end GetBit