08-17-2022, 01:57 PM
I have a few assorted pieces of code that I don't really understand, and I'm wondering if anyone can help explain or break down what the code means.
1)
I know the & symbol means long integer, but is "~" part of the variable name or is this part of the variable type?
2)
Obviously the point of this is "press a key to continue" but the code is not familiar to me. Do followed by : is a new one, and I'm not sure what _Limit 10 is doing on this line.
Additionally "Loop Until" is normal stuff but having Len(Inkey$) afterward isn't something I've seen before. Is this some advanced efficient coding? These two lines as they appear are a bit over my head.
3)
This can be found in the wiki, and it says:
The _MEMCOPY statement copies a block of bytes from one memory offset to another offset in memory.
This purpose of this isn't clear to me. Is it just a quicker copying method (as opposed to setting up loops to copy an array) or is there some other advantage?
Also I have no idea what the OFFSET is doing. The wiki says it's about memory blocks so this seems like a more advanced coding/theory (beyond my level of experience)
4)
This is probably obvious to everyone here but I'm a bit lost. The wiki shows the Wend statement on a completely different line, so if you have this all on one line, what is happening?
The code I'm referring to has a comment at the end (While _MouseInput: Wend ' clear) so the intent is to clear....but how this works to clear is what I'm wondering.
5)
This is straightforward enough, but what's unclear to me is the IF statement:
If m2Dn then
I have never seen this before, where the IF THEN does not have an equation between them. Example:
If m2Dn>1 then
if m2Dn=0 then
I'd definitely like to understand how this works.
Thanks!
1)
Code: (Select All)
variable~&(1)
I know the & symbol means long integer, but is "~" part of the variable name or is this part of the variable type?
2)
Code: (Select All)
Do: _Limit 10
Loop Until Len(InKey$)
Obviously the point of this is "press a key to continue" but the code is not familiar to me. Do followed by : is a new one, and I'm not sure what _Limit 10 is doing on this line.
Additionally "Loop Until" is normal stuff but having Len(Inkey$) afterward isn't something I've seen before. Is this some advanced efficient coding? These two lines as they appear are a bit over my head.
3)
Code: (Select All)
_MemCopy m1, m1.OFFSET, m1.SIZE To m0, m0.OFFSET
This can be found in the wiki, and it says:
The _MEMCOPY statement copies a block of bytes from one memory offset to another offset in memory.
This purpose of this isn't clear to me. Is it just a quicker copying method (as opposed to setting up loops to copy an array) or is there some other advantage?
Also I have no idea what the OFFSET is doing. The wiki says it's about memory blocks so this seems like a more advanced coding/theory (beyond my level of experience)
4)
Code: (Select All)
While _MouseInput: Wend
This is probably obvious to everyone here but I'm a bit lost. The wiki shows the Wend statement on a completely different line, so if you have this all on one line, what is happening?
The code I'm referring to has a comment at the end (While _MouseInput: Wend ' clear) so the intent is to clear....but how this works to clear is what I'm wondering.
5)
Code: (Select All)
m2Dn = _MouseButton(2) ' button 2 processing
If m2Dn Then ' Btn 2 down
This is straightforward enough, but what's unclear to me is the IF statement:
If m2Dn then
I have never seen this before, where the IF THEN does not have an equation between them. Example:
If m2Dn>1 then
if m2Dn=0 then
I'd definitely like to understand how this works.
Thanks!