Can we detect via code when the Switch is docked or undocked?
SmileBASIC 4 Discussion「プチコン4」
Did you try some 3ds programs that work that way on the switch to see if they act differently? P.S. great tutorials btwThere’s a lot of the same functions but SB4 is pretty different. Still figuring out the basics. P.S. Glad I can help man
No access rn but it seems like CONTROLLER(1) is 1 when the system is in portable mode. Seems like that should do it.Unfortunately that doesn't cover it. Controllers can be detached, even in portable mode.
Well, this at least tells you that the device is definitely being used in handheld mode as opposed to docked or tabletop mode. Consider that portable docks exist, and the two aren't so different anyway.No access rn but it seems like CONTROLLER(1) is 1 when the system is in portable mode. Seems like that should do it.Unfortunately that doesn't cover it. Controllers can be detached, even in portable mode.
Well, this at least tells you that the device is definitely being used in handheld mode as opposed to docked or tabletop mode. Consider that portable docks exist, and the two aren't so different anyway.It's probably the best we can hope for, but it doesn't suit my purposes. Was aiming to detect what screen was being used, HDMI out or the Switch's screen. It seems the best I can hope for is to listen for touch input, shame there's nothing automatic though.
from find mode(CTRL+F, F3), hit TAB to get into replacement mode (CTRL+H), first line is the search, second is the replacement, one by one ENTER to replace, or CTRL+ENTER to replace all. saw it in the manual and remembered this post. Dunno if answered before. https://video.twimg.com/ext_tw_video/1153088256143060992/pu/vid/1280x720/HDlTEOrVAuf7osyA.mp4 didnt look for an onscreen keyboard version for replace allIs there a "replace all" or "replace and next" button somewhere with the keyboard's search function? It would do me a number of favors...Shift+find is replace (and it does replace and next by default), but I'm not sure if there's a replace all.
https://twitter.com/notohoho/status/1153616941539479552
<Notice for the upcoming SmileBASIC 4.1.0> To begin with, we're making it easier to play. ■PLAYMENU ・Public works screen: Search by tag, sort order (order by recent popularity, newest works, or most recently updated) ・Local screen: A Button long press submenu (check for updates, delete, and jump directly to BASIC screen for the specified project)■FILEMENU ・Tag setting feature when releasing a work
https://twitter.com/notohoho/status/1153616941539479552These are all great features. An option for automatic project updates would be great as well (even if it's just a prompt to update when you run it.) Something that's a bit interesting is that he hasn't mentioned the additional functions etc. that were missing and they claimed to be adding. I guess they aren't finalized since there isn't even a date and they just wanted to put this out there.<Notice for the upcoming SmileBASIC 4.1.0> To begin with, we're making it easier to play. ■PLAYMENU ・Public works screen: Search by tag, sort order (order by recent popularity, newest works, or most recently updated) ・Local screen: A Button long press submenu (check for updates, delete, and jump directly to BASIC screen for the specified project)■FILEMENU ・Tag setting feature when releasing a work
Can you disable the minus button from opening the on-screen keyboard while the program in a running? Can't seem to find that in the translated docs.
Does anyone have any information on the international releases of SB4? I can't find anything and I'm getting so tired of the built-in help menu being Japanese.
Can you disable the minus button from opening the on-screen keyboard while the program in a running? Can't seem to find that in the translated docs.I can't find it either, but I don't see why you would need it. iirc, you can't detect the minus button using BUTTON() anyways.
There will be an alternative toLOOP ENDLOOP
WHILEand Label loops?
I don't see why you would need it. iirc, you can't detect the minus button using BUTTON() anyways.It's to prevent players from opening the keyboard and covering half of the screen.
Yes, it's an infinite loop. That means it can be used in place of either of these:There will be an alternative toLOOP ENDLOOPWHILEand Label loops?
WHILE TRUE 'code goes here WEND
@LOOP 'code goes here GOTO @LOOPThe only real advantages it has are being able to state your intent more directly than WHILE TRUE, and being able to BREAK and CONTINUE unlike GOTO @LOOP.
yes I love while loops tho :(Yes, it's an infinite loop. That means it can be used in place of either of these:There will be an alternative toLOOP ENDLOOPWHILEand Label loops?WHILE TRUE 'code goes here WEND@LOOP 'code goes here GOTO @LOOPThe only real advantages it has are being able to state your intent more directly than WHILE TRUE, and being able to BREAK and CONTINUE unlike GOTO @LOOP.
There's no way to disable it. That said, if they're opening the keyboard, they're probably doing it on purpose, so I don't see the point in disabling it. It's the only way (without a USB keyboard) to run a subprogram while your game is running, for instance, so it does have utility even if there's no reason to type in your game.I don't see why you would need it. iirc, you can't detect the minus button using BUTTON() anyways.It's to prevent players from opening the keyboard and covering half of the screen.
LOOP/ENDLOOP should be faster than @LOOP/GOTO @LOOP
WHILE,FOR,LOOP,REPEAT,IF,etc. all use literal addresses to jump to, while GOTO has a pointer to a position in the name table, where the address of the label is stored.
WHILE/REPEAT are still slower than GOTO because they have to check the condition, though.
LOOP/ENDLOOP should be faster than @LOOP/GOTO @LOOP WHILE,FOR,LOOP,REPEAT,IF,etc. all use literal addresses to jump to, while GOTO has a pointer to a position in the name table, where the address of the label is stored. WHILE/REPEAT are still slower than GOTO because they have to check the condition, though.The interesting thing about that is for constant labels it's very easy to optimize in an absolute jump. In most cases a name table lookup shouldn't even be necessary. At least, you COULD, if you didn't allow jumping across slots.
Yeah it would've been simple to just make a second pass through the bytecode to replace label addresses when possible.
The reason it uses the nametable is because if you have something like:
GOTO @A
@A
with GOTO @A, it checks for @A in the table, doesn't find it, and so it adds an entry (but without an address set), and outputs bytecode using the position of that item in the nametable.
then when it reaches @A, it finds that in the nametable so it fills in the address.
But for some reason, even if the label is BEFORE the goto, it still does this.