LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

Lowerdash General Questions thread

Root / Programming Questions / [.]

AGAaronCreated:
Hello, I looked back in the log and I'm really surprised this thread doesn't exist yet! o_O I would appreciate a sticky! I think Lowerdash deserves a general thread as I can forsee more people than myself having multiple questions about it's operation. For anyone that doesn't know about Lowerdash, it's adds supplemental features to SmileBASIC such as objects, prototypes, immutable dictionaries and much more! I am particularly interested in using OOP in my projects and have only just started to use it. The creator kldck_hul (aka HissingToast) drops by this site to at the very least update the manual & hopefully he'll find his way to this thread too. ; ) Download: http://smilebasicsource.com/page?pid=59 Manual: http://smilebasicsource.com/page?pid=145

I'll start this thread off with my own problem: https://miiverse.nintendo.net/posts/AYMHAAACAAADVHk1gsn0pA Resolved To summarize, it seems the compiler is not loading correctly or something as 'main' only produces a syntax error. I have tried putting 'lowerdash_c' in both program slots 1 & 2, both producing the same result.

That's weird. I 've been using lowerdash for a long time and I haven't got that issue. Remember that you must put both lowerdash and lowerdash_c on your development project. Could you post the code of the file that load the framework? Maybe there is the problem.

That's weird. I 've been using lowerdash for a long time and I haven't got that issue. Remember that you must put both lowerdash and lowerdash_c on your development project. Could you post the code of the file that load the framework? Maybe there is the problem.
I actually do *not* have it loading both 'lowerdash' & 'lowerdash_c'. In which slots should I put each? Both files in the comments at the top are telling me to put them in slot 2. Which actually goes in 1? Also, should I load them both up through code such as how I did with 'lowerdash_c' as shown in the picture on Miiverse or do I need to do it manually for one? Thanks for the help raimondz!

You must load lowerdash_c in slot 2 and use that. When you start the program, lowerdash_c will compile the file lowerdash alogn with those included in the head block. When you compile the program using the statement "compile 'output' " on the head block, then the program will be executed and it will generate a file that contains the code on slot. This is useful when you want to release the program. On this case, you must load this file on slot 2. PS: I saw the pic in miiverse. You must load lowerdash before using head and main. Also, you should use function instead of labels.

I use functions if I need to return a variable, they will definitely be implemented as I progress though. I found the problem, by the way and it works now! I had the wrong slot selected with USE T_T. A silly mistake!

Sorry I missed the Miiverse post. Lowerdash_c is the compiler. It should be loaded into slot 2. When you call head, it will load Lowerdash into slot 3. Lowerdash is the runtime. It gets automatically loaded into slot 3 by the compiler. If you compile a program as raimondz mentioned, you should load that directly into slot 3. I want to make Lowerdash more slot agnostic, but for now, this is the best way to initialize slot-wide variables at main Fun fact: 0.5 doesn't use Slot 2 during runtime. So you can load like the raycaster there and still have 2 editor tabs.
Also, you should use function instead of labels.
Labels are actually a teeny bit faster. Lowerdash has module labels (@@), but I don't use them enough to know if they have overhead. They create a bunch of fun GOTO jumps when you first do main.

I would appreciate a sticky!
Oof I should probably add the ability to sticky threads then. Um but first I have to look up what a sticky thread even is lol. Sorry for barging in.

Sorry I missed the Miiverse post.
It's cool! Got everything resolved. I hope to mess about with objects tomorrow. Also good to know regarding the labels. I'll revert all the functions I can back to labels again >.>

Also good to know regarding the labels. I'll revert all the functions I can back to labels again >.>
I didn't see the code in question, so I'm just adding general advice. Labels are faster, but Lowerdash will require functions for instance methods. I also often write functions just to keep the scope (list of variable definitions) clean. It's really a matter of personal taste and how fast that piece of code has to run. I'm excited to have another bug finder user! I've been way too busy to really sit down and break 0.5.

Also good to know regarding the labels. I'll revert all the functions I can back to labels again >.>
I didn't see the code in question, so I'm just adding general advice. Labels are faster, but Lowerdash will require functions for instance methods. I also often write functions just to keep the scope (list of variable definitions) clean. It's really a matter of personal taste and how fast that piece of code has to run. I'm excited to have another bug finder user! I've been way too busy to really sit down and break 0.5.
They were all coming off of the main loop, a basic framework for the game. It lists out stuff like an input poller, renderer, scene management, all currently doing nothing yet. If subroutines are faster, I will use that for these as I always have. I will use functions when I have need to return variables, use more than once per frame or just to keep organized because keeping scope is keeping tidy. I would like to create a controllable object by tomorrow, which should be useful for a game idea I've had that could make use of OOP. Hopefully I'll break Lowerdash real good for you, haha. What kind of info would you like me to give in the case I do? I assume it keeps no error log?

I have a new question now concerning prototypes. It would appear I could use one to make as a template for another class, so I take it I could do something like make a prototype loaded with information such as animations and hitboxes then use that prototype within a module that has information such as what commands use which animations, AI & other information? I would love for a practical example, I see the BALL demo uses PROTO (named "INBOUNDS"), however I don't see it to being any benefit or what that is for. Thanks in advance for any help!

I have a new question now concerning prototypes. It would appear I could use one to make as a template for another class, so I take it I could do something like make a prototype loaded with information such as animations and hitboxes then use that prototype within a module that has information such as what commands use which animations, AI & other information?
Yep! In my game library, I use a prototype's constructor (and its prototype's constructor) to setup the sprite and hitbox and get a Physics management number.
I would love for a practical example, I see the BALL demo uses PROTO (named "INBOUNDS"), however I don't see it to being any benefit or what that is for. Thanks in advance for any help!
This is a much better example. I might try to adapt it to something simple. (The problem is a ball demo can't have THAT many animations) The inbounds mixin could be used with other modules as well. A bullet can check if its inbounds. I admit, its a contrived example trying to emulate what happens when, e.g, you have a physics library handling that part.

I have a new question now concerning prototypes. It would appear I could use one to make as a template for another class, so I take it I could do something like make a prototype loaded with information such as animations and hitboxes then use that prototype within a module that has information such as what commands use which animations, AI & other information?
Yep! In my game library, I use a prototype's constructor (and its prototype's constructor) to setup the sprite and hitbox and get a Physics management number.
I would love for a practical example, I see the BALL demo uses PROTO (named "INBOUNDS"), however I don't see it to being any benefit or what that is for. Thanks in advance for any help!
This is a much better example. I might try to adapt it to something simple. (The problem is a ball demo can't have THAT many animations) The inbounds mixin could be used with other modules as well. A bullet can check if its inbounds. I admit, its a contrived example trying to emulate what happens when, e.g, you have a physics library handling that part.
I read over it again and I must have missed the INBOUNDS module. Having seen it, I think I understand it's implementation now. I use PROTO within or right after declaring a MODULE and then it inherits the properties of another MODULE by the same name as a prototype. In other words, I think it's all understood now & I'll be sorting out a bunch of code!

I use PROTO within or right after declaring a MODULE and then it inherits the properties of another MODULE by the same name as a prototype. In other words, I think it's all understood now & I'll be sorting out a bunch of code!
Yep! One caveat- It's one command now (0.5):
MODULE name [PROTO name]
where [PROTO name] is optional. It is needed IMMEDIATELY after MODULE, and I think it was misleading to have the option of putting it in the wrong place. Only downside is that, that one line can get pretty long. EDIT: I fixed that example

I use PROTO within or right after declaring a MODULE and then it inherits the properties of another MODULE by the same name as a prototype. In other words, I think it's all understood now & I'll be sorting out a bunch of code!
Yep! One caveat- It's one command now (0.5):
MODULE name [PROTO name]
where [PROTO name] is optional. It is needed IMMEDIATELY after MODULE, and I think it was misleading to have the option of putting it in the wrong place. Only downside is that, that one line can get pretty long. EDIT: I fixed that example
Great! Corrected it in my own code. Yes, I see you updating at least weekly these days. I have a plan for a game that would use objects, but I have made no calls yet as I've got about 600 lines of code I'm using as a framework for the rest of the game right now. I'm just happy it compiles, but looking forward to calling some of my objects when I think they are done. Oh! That does remind me I have had trouble running it 'scripted' through LowerDash though (as in, not compiled). 'head' gives back a syntax error, but it works when I compile, so I've just been doing that. Secondly, how do I run the compiled program? It runs fine after compiling, but I can't seem to run it on it's own. It starts with 'END', after all... so what do I do with it? I must be missing something. Thanks for all your help & extra thanks for all the updated documentation! It's been really helpful, because of it I should have some an 'entity' prototype & other objects ready to test soon. Looking forward to 0.5!

Oh! That does remind me I have had trouble running it 'scripted' through LowerDash though (as in, not compiled). 'head' gives back a syntax error, but it works when I compile, so I've just been doing that. Secondly, how do I run the compiled program? It runs fine after compiling, but I can't seem to run it on it's own. It starts with 'END', after all... so what do I do with it? I must be missing something.
I'm curious what the syntax error is. You end the head with hend. To load the compiled file, you still have to have a program with a MAIN section. The compiled code can be loaded into slot 3 instead of loading LOWERDASH_C in slot 2 and having a HEAD section. It is a file containing the Lowerdash runtime as well as your compiled code. It is possible to copy and paste your MAIN section to the top of the compiled file just before that END you noticed. (Slot 3 will still be hard coded... part of why theres no tool for this yet)

Oh! That does remind me I have had trouble running it 'scripted' through LowerDash though (as in, not compiled). 'head' gives back a syntax error, but it works when I compile, so I've just been doing that. Secondly, how do I run the compiled program? It runs fine after compiling, but I can't seem to run it on it's own. It starts with 'END', after all... so what do I do with it? I must be missing something.
I'm curious what the syntax error is. You end the head with hend. To load the compiled file, you still have to have a program with a MAIN section. The compiled code can be loaded into slot 3 instead of loading LOWERDASH_C in slot 2 and having a HEAD section. It is a file containing the Lowerdash runtime as well as your compiled code. It is possible to copy and paste your MAIN section to the top of the compiled file just before that END you noticed. (Slot 3 will still be hard coded... part of why theres no tool for this yet)
Yes, I switch between the compile and hend commands by commenting out the opposite. After 'main'? First it's a label, then ACLS. It prints a message notifying user of startup and it makes several global declarations then goes into the main loop from there. I have no clue what could be causing the error either, unfortunately. Edit: Oooh! I see what you're saying. I will try adding the 'main' command to that compiled file then.

I have no clue what could be causing the error either, unfortunately.
What does the error say?
makes several global declarations
I don't know if you're aware, but SmileBasic doesn't have true globals; top-level variables will be bound to the slot. So you can only retrieve them in other slots with VAR("1:myGlobal"). I've been dropping my "globals" in a separate imported file, which makes them available in the same slot as module code.

I have no clue what could be causing the error either, unfortunately.
What does the error say?
After 'main'? First it's a label, then ACLS.
MAIN runs any loose code that is in the modules and sets up the variable declarations. ACLS should come before MAIN
There is no error feedback, unfortunately. It just says "[GAME]OK", like it performed an END & triggered the program ending when 'main' is used. Also I finally got around to trying out objects. It simply cannot find them. I have them saved under "_OBJDATA" and have set that to be imported. It cannot see my "Entity" MODULE. The Lowerdash error: "No module named Entity", however that is not true, it is in that imported _OBJDATA file. Thanks for all the help as usual!