BenJeremy
Dec 17 2003, 01:38 AM
Well, there are more goodies coming down the pipeline... in the "WIP" build, I now have FOR/NEXT and GOSUB/RETURN support:
| CODE |
FOR <var> = <start> TO <end> [STEP <stepval>] : : [BREAK] : : NEXT
Where: <var> is the name of the var to track the value (Incremented on NEXT) <start> is the value assigned to the named variable the first time through. <end> is the value <var> is compared against on "next" - if it's greater, ActionScript continues AFTER the NEXT <stepval> is an optional increment (or decrement, if <start> is greater than <end>) on each NEXT
BREAK skips to the appropriate NEXT and exits the loop prematurely.
|
So that's FOR/NEXT operation in a nutshell. It should clean up code nicely...
| CODE |
GOSUB <label>
:<label> : : RETURN
Pretty straightforward... put subroutines in your script, stay "local" with variables and such. On "RETURN" the script will return to the line AFTER the GOSUB.
|
There you go. I might do DO/WHILE if I get around to it....
geniusalz
Dec 17 2003, 02:16 AM
Quick q: Is recursion supported?
SumDumGuy2
Dec 17 2003, 02:42 AM
Bravo... I don't know how you do it man... but anyway you slice it up, You have nudged XBMP out of my number 1 spot for favorite app and that was not easy to do, trust me... I am definitely going to have to pay your tipcup a visit when I get some change... keep up the good work
geniusalz
Dec 17 2003, 06:01 AM
Heh. I asked whether nested FOR loops are supported in the other thread, but here I asked for
recursion here.
Like recursive factorial computation
* Ignore all the syntax errors

*
SETVAR N 5
SETVAR result 1
GOSUB Factorial
:Factorial
MUL result %N%
SUB %N% 1
IF# N==1 GOTO Blah
GOSUB Factorial
Blah:
RETURN
geniusalz
Dec 17 2003, 05:57 PM
Bad things. Now I see how exploits work. So you could have people writing exploits for MXM if it didn't prevent stack overflows

. But I don't know what use the exploits will be.

But good to see a responsible programmer taking care of this
::end of rambling
geniusalz
Dec 17 2003, 06:32 PM
As for the if blocks, they can be easily converted to a whole slew of GOTO statements. I wrote a little prog to do this, but right now it has problems recognizing code blocks (inside ifs) more than a line long.
Update: Fixed that bug, click to download
MXM Scripter pre-alpha 1.1
Infared
Dec 17 2003, 09:51 PM
hiya guys,
happy holidays,
umm im kinda a newb at this xbox stuff ... and i would like to know what this "For/next And Gosub/return" is about

thx
geniusalz
Dec 17 2003, 11:05 PM
It's all for scripting.
Sort of like BASIC programming.
You can do stuff like write/read xml files through scripting, copy/delete/renames files and folders, display stuff on the screen. Basically a limited programming language for the xbox that is easy to learn, that runs inside MXM.
In other words, don't worry about it, as you can use MXM without knowing any of this.