This isn't a game -- it's more like a utility. It allows you to program your 3DS in BASIC. It takes some learning, but it's pretty powerful, and it has a lot of functions and utilities to make game design a little easier.
Pointers? I could have sworn there was a way to refer to a variable named in a string (for example, if A$="X", it could be used to refer to the variable X), but I've been through all of the instructions, and I can't find it. I might be thinking of a different language.
Since Z isn't listed in the definition for FUNC, it isn't masked off in any way. Therefore, when we use its value in line 7 and change it in line 9, we use it as a regular global variable, and it IS altered to 22 after the call to FUNC.
This is all rather confusing, but hopefully it makes at least some sense and shows you how careful you have to be about the variables you use in your functions.
When Y is passed in as the value of B for a call to FUNC, it's passed by VALUE rather than REFERENCE. So when we change the local value B in line 8, the global value of Y is unaffected. After the call to FUNC, Y is still 3.
Our global variable B is masked off when we call FUNC, and so it's not affected by line 8, so after FUNC is called, it's still 10. Likewise, our global variable X is masked off when FUNC uses X for its return value, so it's still 7 after FUNC is called.
Notice that the function uses LOCAL values for all of the variables named in its definition, and GLOBAL values for all other variables. When the function evaluates A+B+Z, it uses the value 2 (passed in) for A, 3 (passed in as the value of Y) for B, and 20 (the global value) for Z. So when we return, A (our output variable in line 3) is 2+3+20=25.
... you're going to have a hard time rewriting it in the new system on your own. You might have to retranslate everything on a line by line basis, and the fact that all of the sprite and background graphics have been completely overhauled might make it useless anyway.
I'm starting to realize this program's been copied line for line from something written in PTC. The syntax for many, many of the commands have changed between the two versions. If this is your own program, you'd do well to spend some time flipping through the documentation at smilebasic.com (particularly the long instruction list) to see what's changed. If this is someone else's program...
Java is obviously a more advanced language than BASIC, with object-oriented features and all, but knowing the basic principles of programming puts you one step ahead of the game.
I'm guessing that you're trying to create user-defined routines without return values so that you can call them as commands, like:
DEF ROUTINE(X,Y)
...
END DEF
ROUTINE(A,B)
A function with arguments has to return a value. Read the doc for user-defined functions carefully, or post a screenshot of your code so we can see what's up.
@GTAerohog
This is probably the one thing I dislike about this new version so far, as I liked using START for submenus and such. I'm guessing they figured that the START and SELECT were positioned close to the Home button on the standard 3DS and so were more like system keys than gameplay buttons.
A is 16. But in fact, there's a clever feature in this version: you can just write it as "#A" for clarity in your code and so you don't have to remember the number or look it up every time. So:
IF BUTTON(2)==#A THEN ...
Type BUTTON on any blank line and tap the ? button in the upper right of the keyboard for a list of all the button codes. Scroll through it with the circle pad while you edit.
Oh dear. Yeah, the START button has been taken over. Just like SELECT in PTC was a Break key, Start is now a break key as well. You'll have to figure out a different button to start with.
BUTTON()== will give you information for any button that happens to be held down at the time you call it. If you want the edge information of BTRIG -- that is, you only want to find out about a button at the moment it's pressed -- you use BUTTON(2)== instead of BTRIG()==.