how can I peek a word value?

Blitz3D Forums/Blitz3D Programming/how can I peek a word value?

dman(Posted 2011) [#1]
Trying to use the peek command but theres no word for it.

I'm guessing to use PeekInt() to get a word, I'm not sure.


Matty(Posted 2011) [#2]
How many bytes do you want to read:

peekbyte, peekshort or peekint are all useful...


dman(Posted 2011) [#3]
trying to peek a word not a byte, rather two bytes.


Kryzon(Posted 2011) [#4]
Two bytes -> PeekShort().


dman(Posted 2011) [#5]
thanks for the info, I appreciate the help.

one thing, about the FOR loop, the step command only takes constant values. How can I use a assigned variable? ex.

range = 12


FOR b=0 TO length STEP range


Yasha(Posted 2011) [#6]
You can't, you'll have to redesign the loop as a While or Repeat.
b = 0
While b <= length    ;Shouldn't this be < ?
    ...
    b = b + range
Wend



Kryzon(Posted 2011) [#7]
It should be just "<" if you're starting from 'zero' (and you are: "b = 0").

If you started at '1' then you can let it get to the 'length' (which is always 1-based as well).

Last edited 2011


Warner(Posted 2011) [#8]
Also, you can use this:
const range=12
For b=0 to length STEP range
Or this:
For b_=0 to length/range b=b_*range



K(Posted 2011) [#9]
What I do often is to run for..next as normal:
For k=1to 10
Next

And then judt throw in k*range wherever k effexts what happens. Equivalent to "1to 10 Step range".

Last edited 2011

Last edited 2011


Warner(Posted 2011) [#10]
Also, this:
For b=0 to length
  print b
  b = b + range-1
Next