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

DocWaluigean's Extremely Annoying Millions of Questions

Root / Programming Questions / [.]

DocWaluigeanCreated:
Hello, I'm new to the communities involving SmileBASICSource. I don't want to tell anyone if I have autism or not, but lets just say I have complex in understanding programming situations. I asked a lot of questions to try to understand certain codes, but I don't want to be bothersome about things..even if it's too repetitive and simple. So I made this thread so I can express or speak whatever I want without feeling very bothersome to anyone. Possibly all my questions will be here. And yes, I'm from NESDev, and I would come back to it later when I gain enough confidences in myself. The first question I have now is what do I make now? A "Hello World" program with nothing but PRINT and things?

I made my first program! But I can't use keyboard with SmileBASIC 4.


Before I go to sleep, one important question: What is the list of most common code used like PRINT?

randomous' tutorial series: http://smilebasicsource.com/page?pid=402 niconii's language changes guide: http://smilebasicsource.com/page?pid=1362 enclosed instruction booklet: https://sup4.smilebasic.com/doku.php?id=reference:top

Thank you very much, Yolkai! So I'm back! I read the official Japanese tutorials about it! Here's what I read about: PRINT VIBRATE BEEP and other important features: SPSET SPOFS SPROT HERE'S WHAT I BELIEVE IN THIS THEORIES AND SITUATIONS: SPSET is a SPrite SET, meaning "setting up the sprite, like give the sprite permission to appear in your program or games" SPSET 10, 0 The first digit of where 10 is are the identity of the sprite, and the second digit where 0 is is the location of the sprite. Zero is usually where strawberry is. So, judging by that, if you want to use it or place it in somewhere on that specific sprite, you always have to put 10 on the first digit on SPOFS SPOFS might mean SPrite OFfSet to mean the amount or distance by which something is out of line. Most likely wrong words. SPOFS 1, 2, 3 The digit of 1 is an identification of what SPR/SPRITE is judging from SPSET. The digit of 2 is the location of the X-axis (Left and right) where higher number means the sprite will go right. The digit of 3 is the location of the Y-axis (Up and down) where higher number means the sprite will go down. SPROT 1, 359 Obviously SPrite ROTate. The digit from 1 is the identity from SPSET 1. The digits from 359 is the rotation angle. 0 and 360 is the same thing. The sprite turns around toward 359 degrees. Then there's VSYNC and LOOP with IF THEN and THEN BREAK and ENDLOOP Like.... LOOP JOE = JOE + 1 VSYNC IF JOE == 100 THEN BREAK ENDLOOP It will keep adding JOE the Variable into one every 1/60th second, and if it reaches 100, it will "break" and continue the code after ENDLOOP. VSYNC is a special kind of "WAIT" code where instead of infinite, it's frame by frame, or 1/60 second by 1/60 second. If you don't have VSYNC in anyway, IT WILL MOVE INCREDIBLY FAST WITHOUT ANY STYLE OF VSYNC!!! There's the BUTTON function, but I didn't use it at all. ---- So the question is.. am I right 100% on understanding? Or there's something I am missing right now?

I'm reading the Randomous's tutorial right now while figuring out what to have fun in program: On part 3, What is the point in using DIM and VAR? In GameMaker stuff, there's 3 types of variables: Global, Normal {I forgot the name}, and Local. Global is that the variable can be used by ANYTHING in the program, while Local is only used once in one code. I remember that VAR is used to use the code ONCE then get deleted if the code is finished, which is to save memory so much. So in this situation, what's the point in DIM and VAR and what's the differences? I know I have to re-read it to get it, but I always get confused in anything.

DIM and VAR declare variables you will use. These do the same thing, so you can use whichever you like. In fact, you can use variables without using DIM or VAR.
COOKIES%=5
PRINT "I have ";COOKIES%;" cookies!"
When you put OPTION STRICT at the beginning of your code, you must use DIM or VAR to use variables.
OPTION STRICT
VAR COOKIES%=5 'I will use COOKIES%
PRINT "I have ";COOKIE%;" cookies!" 'But COOKIE% isn't declared!
In this case, if you use variables without DIM or VAR, it stops with Undefined variable error. Therefore, it prevents you from mistaking variable names.
SpoilerIf you use DIM or VAR in DEF code, it will be a Local variable which can be used only in the DEF. The other variables are Global variables. (I don't know what Normal variable is. Sorry.)
DEF ABC
 VAR X%=15
END
X%=150 'This X% is different from the X% in ABC
In addition, you have to use DIM or VAR if you use array variables. (like DIM ARY%[5]) (Is this the right way to use spoiler? I'm also new to SmileBASIC Source.)

In Smilebasic you have primary 2 types of Variables: global and Local. All variables will be global, if you don't write them in a function. Inside the Function you can use local Variables, and manipulate the global.

HOLY SMOKES English is now supported in official English name: SmileBASIC 4. Is there a way to change it back to Japanese? I don't mind either way.

I just found a way to change languages: you have to go to Settings in home menu on the Switch, not the Smilebasic 4, and change your languages found in the bottom section of the setting list. So I’m reading the DIM/VAR in SmileBASIC 4, and there are two extra pages compare to 3ds, only two, what is new to DIM and VAR??

There’s a opcode called SGN, and it’s telling me “get the sign”. What is it used for and what good example could I use for it? I looked up into the help on sb4 and it said A=SGN(12.345).. any use for it? I see FALSE is no longer the code anymore, so I have to use #FALSE now? What does INIT mean when I look in other peoples code, and the official code? —- After frustrations on DATA atm, I’m looking into the Smilebasic official game with Jamaica story. So the option is Strict, and I hope to remember everything one person told us about it. What is a CONST? I know I can look into a book, but I always suck at getting the message across, like in NESDev 6502. It took me days to figure out what A X Y Register does. I checked it out what XSCREEN does now: It changes the format of how the screen gets zoomed in or not instead of what 3ds is. What is a TSCREEN? Set the width of console and font used for display. Examples please or good explanation using children analogy or food or smash brothers analogy so I can remember better... GTARGET. Specifying the graphic drawing target page. So it’s to change the usage of graphic? ...or...? That game has too many VAR and CONST... SNDSTOP stops all the sounds. Got it. Now, I get what SPSET is thanks to the beginners guide, but... SPHOME, SPLINK, SPCOL, SPFUNC. I’m feeling that SPCOL is to make the character appear “Huey color” no matter the sprite color used.
SPCOL 1, 15, 100
In this pseudo code, the 1 is the ID of the sprite, 15 is the color, which I call it blue, and 100 is the opacity of the color, the character appearing full blue. Is this semi correct? Aside from SPCOL, what does SPHOME, SPLINK, SPFUNC, SPPAGE, SPUSED, SPVAR, and SPCOL do? And what does SPANIM do? Looking through the code, there’s SPCOLOR, so I am not sure what SPCOL and SPCOLOR does now.... SPSCALE and FILL? SPSCALE is a code that allows you to stretch or fatten the sprite, right? The SPSCALE 1, 20, 10 which is 1 as ID, 20 as X axis, and 10 in Y axis, which would make the sprite so widen and fatten left and right, Right? GLINE? SPHITSP? Hilaiously, SETANIM is not an opcode, but SPANIM is

I’m sorry if it’s so annoying, thats why I made this thread of me asking millions of annoying questions. I don’t go into other people’s code and ask the stupidest obvious questions, and having overwhelm with figuring out what it does and what limitations does and stuff. I know programming isn’t fun and easy, which is why there isn’t any fun pictures or fun stuff for beginner codes like what BEGINNER GUIDE in SmileBASIC 4 has.

I’m sorry if it’s so annoying, thats why I made this thread of me asking millions of annoying questions. I don’t go into other people’s code and ask the stupidest obvious questions, and having overwhelm with figuring out what it does and what limitations does and stuff. I know programming isn’t fun and easy, which is why there isn’t any fun pictures or fun stuff for beginner codes like what BEGINNER GUIDE in SmileBASIC 4 has.
What do you mean "not fun?" Programming can be really fun if you're into what your doing. I always find it super satisfying when I make a world system that works, or learn a new concept that I didn't previousley know. Sure, it can be hard, but you can make it fun. Sorry if this sounds rude in any way.

I’m sorry if it’s so annoying, thats why I made this thread of me asking millions of annoying questions. I don’t go into other people’s code and ask the stupidest obvious questions, and having overwhelm with figuring out what it does and what limitations does and stuff. I know programming isn’t fun and easy, which is why there isn’t any fun pictures or fun stuff for beginner codes like what BEGINNER GUIDE in SmileBASIC 4 has.
What do you mean "not fun?" Programming can be really fun if you're into what your doing. I always find it super satisfying when I make a world system that works, or learn a new concept that I didn't previousley know. Sure, it can be hard, but you can make it fun. Sorry if this sounds rude in any way.
One of my old friend years ago told me that Randomouscrap (Sorry if it’s you or not. I’m still new to this site.) said in the anonymous chat that no one is interested in programming BASIC as common as the old days anymore and no one “could force him to do what they say”? It kind of strike me as a warning not to fool around and learn something with proof here or I get scolded. Like the rules of NESDev stuff about not to be an a.s.s. or something. So sorry if I made error explaining. Your right, programming can be fun. But not many took the time to enjoy the pedagogue in programming. I’m around 24 years old and I struggle with learning things that looks boring compare to my high school days where it kind of was the last school where learning is fun. Again, sorry, just need to show my background a little to tell where I come from. If you were in NESDev and see me there, you totally understand where I’m coming from.

Oh ok

There’s a opcode called SGN, and it’s telling me “get the sign”. What is it used for and what good example could I use for it? I looked up into the help on sb4 and it said A=SGN(12.345).. any use for it?
I found this code in GAME3JUMP(a sample game in SB3)
AX1=AX1-(0.05*SGN(AX1))
If AX1 is larger than 0, it decreases AX1 by 0.05 If AX1 is smaller than 0, it increases AX1 by 0.05 Therefore, AX1 will eventually be 0.
I see FALSE is no longer the code anymore, so I have to use #FALSE now?
Yes.
What does INIT mean when I look in other peoples code, and the official code?
It means initialize.
What is a CONST? I know I can look into a book, but I always suck at getting the message across, like in NESDev 6502. It took me days to figure out what A X Y Register does.
It is constant. It's different from variables because constants can't be changed after.
CONST #COOKIES=5 'You can't change the number of cookies anymore
Now, I get what SPSET is thanks to the beginners guide, but... SPHOME, SPLINK, SPCOL, SPFUNC. I’m feeling that SPCOL is to make the character appear “Huey color” no matter the sprite color used.
SPCOL 1, 15, 100
In this pseudo code, the 1 is the ID of the sprite, 15 is the color, which I call it blue, and 100 is the opacity of the color, the character appearing full blue. Is this semi correct?
No. SPCOL means sprite collision. It allows to use SPHITSP or SPHITRC, which checks whether sprites hit other sprites. But you can change the color of sprite with SPCOLOR.
SPCOLOR 1,#C_BLUE

There’s a opcode called SGN, and it’s telling me “get the sign”. What is it used for and what good example could I use for it? I looked up into the help on sb4 and it said A=SGN(12.345).. any use for it?
I found this code in GAME3JUMP(a sample game in SB3)
AX1=AX1-(0.05*SGN(AX1))
If AX1 is larger than 0, it decreases AX1 by 0.05 If AX1 is smaller than 0, it increases AX1 by 0.05 Therefore, AX1 will eventually be 0.
I see FALSE is no longer the code anymore, so I have to use #FALSE now?
Yes.
What does INIT mean when I look in other peoples code, and the official code?
It means initialize.
What is a CONST? I know I can look into a book, but I always suck at getting the message across, like in NESDev 6502. It took me days to figure out what A X Y Register does.
It is constant. It's different from variables because constants can't be changed after.
CONST #COOKIES=5 'You can't change the number of cookies anymore
Now, I get what SPSET is thanks to the beginners guide, but... SPHOME, SPLINK, SPCOL, SPFUNC. I’m feeling that SPCOL is to make the character appear “Huey color” no matter the sprite color used.
SPCOL 1, 15, 100
In this pseudo code, the 1 is the ID of the sprite, 15 is the color, which I call it blue, and 100 is the opacity of the color, the character appearing full blue. Is this semi correct?
No. SPCOL means sprite collision. It allows to use SPHITSP or SPHITRC, which checks whether sprites hit other sprites. But you can change the color of sprite with SPCOLOR.
SPCOLOR 1,#C_BLUE
So a SGN is a "Round the numbers down or up from .5 -> 1.0 or .4 -> 0.0 ? I see. "set to the value or put in the condition appropriate to the start of an operation." I kind of don't understand. Is this means "A type of variable creation mode"? Like INIT section is a full of variables and DIM and VAR? So CONST [Constant] is a permanent-lockup VAR/DIM/ regular variables where, no matter what, you can NOT change the variables before and after line? What was the point when you could just not change the VAR/DIM/variables? Or it's a "String/Word-only" variable? SPrite HIT SPrite and SPrite HIT [R?] Check? I'll think about those. There's still many more questions I need to answer, but thanks for replying. How can code be easy to learn?

So a SGN is a "Round the numbers down or up from .5 -> 1.0 or .4 -> 0.0 ?
SGN takes a number as input and returns: * -1 if the number is negative * 1 if the number is positive * 0 if the number is 0

SGN checks if a number is greater or less than 0
SGN(100) -> 1
SGN(0) -> 0
SGN(-5) -> -1
CONST is faster than using a variable (it's the same speed as using a number directly)
CONST #SIZE = 8 * 2
VAR SIZE = 8 * 2

X = X + SIZE 'slower
'These are the same speed:
X = X + 16
X = X + 8*2
X = X + #SIZE