? Def codes for making codes (Page 3) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password

Def codes for making codes

1 2 3
  • #41 ✎ 131 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies
    i know there has to be a way to create faster graphics(like a custom GPU). How come none of us compile our knowledge into the same project?
    I've thought of this before. SmileBASIC is pretty limiting in speed. The graphics they give us are the fastest we're going to get.
    Posted
  • #42 ✎ 54 dfrost2 Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Minecraft Is Awesome! I love Minecraft! Express Yourself [url=https://www.youtube.com/watch?v=oHC1230OpOg]https://www.youtube.com/watch?v=oHC1230OpOg[/url] maybe there is a way. Make an array: DIM SCREEN[400,239] 'And then use it to store all 'for a line: DEF LINE X,Y,X2,Y2 VAR X,Y WHILE 1 X = WEND Posted
  • #43 ✎ 1464 12Me21 Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Second Year My account is over 2 years old Website that would be a lot slower. Graphics in SB are already pretty fast anyway. Posted Edited by 12Me21
  • #44 ✎ 876 snail_ Helper Received for being very helpful around SmileBASIC Source Achievements First Day Joined on the very first day of SmileBASIC Source Website Night Person I like the quiet night and sleep late. Express Yourself We're in a sandbox. We don't have direct memory management or addressing of the GPU so it's actually impossible. The graphics primitives we have are all we are given and we can't do anything better. Posted
  • #45 ✎ 173 spaceturtles Video Games I like to play video games! Hobbies Avatar Block I didn't change my avatar for 30 days. Website Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength
    We're in a sandbox. We don't have direct memory management or addressing of the GPU so it's actually impossible. The graphics primitives we have are all we are given and we can't do anything better.
    Except with hacks but what we have should be fine.
    Posted
  • #46 ✎ 131 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies
    'JOIN AN ARRAY OF STRINGS TOGETHER 'STRING_ARRAY, DELIMITER DEF JOIN$(S$,D$) IF !LEN(S$) THEN RETURN "" IF LEN(S$)==1 THEN RETURN S$[0] RETURN JOIN$(S$,D$)+D$+POP(S$) END
    Holy crap, that is a kind of recursion I never thought of before. Never even imagined it.
    Posted
  • #47 ✎ 54 dfrost2 Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Minecraft Is Awesome! I love Minecraft! Express Yourself I just played some Fortnite(which uses UE4) and I noticed something: when you are far away from an object, the resolution is really low. Also, the triangle count in an object decreases. Maybe Simeon can (somehow) implement this in SIM.3D... Posted
  • #48 ✎ 57 ninjagnu Avatar Taboo I didn't change my avatar for 180 days Website Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength
    I just played some Fortnite(which uses UE4) and I noticed something: when you are far away from an object, the resolution is really low. Also, the triangle count in an object decreases. Maybe Simeon can (somehow) implement this in SIM.3D...
    I think that's called mipmapping but I'm not sure...
    Posted
  • #49 ✎ 1464 12Me21 Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Second Year My account is over 2 years old Website I believe mipmapping only refers to reducing the resolution/detail of textures when they're far away, but why are you talking about this in this thread? Posted
  • #50 ✎ 876 snail_ Helper Received for being very helpful around SmileBASIC Source Achievements First Day Joined on the very first day of SmileBASIC Source Website Night Person I like the quiet night and sleep late. Express Yourself
    I just played some Fortnite(which uses UE4) and I noticed something: when you are far away from an object, the resolution is really low. Also, the triangle count in an object decreases. Maybe Simeon can (somehow) implement this in SIM.3D...
    I think that's called mipmapping but I'm not sure...
    That's called Level of Detail or LOD.
    Posted Edited by snail_
  • #51 ✎ 173 spaceturtles Video Games I like to play video games! Hobbies Avatar Block I didn't change my avatar for 30 days. Website Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength
    I believe mipmapping only refers to reducing the resolution/detail of textures when they're far away, but why are you talking about this in this thread?
    It can become more relevant if someone posted DEFs for those. That is, if they'll take the time.
    Posted
  • #52 ✎ 876 snail_ Helper Received for being very helpful around SmileBASIC Source Achievements First Day Joined on the very first day of SmileBASIC Source Website Night Person I like the quiet night and sleep late. Express Yourself BDIALOG - Show a dialog box and wait for a button press. But that function already exists! It does, but it's terrible. The return values hardly make sense and you can only specify certain sets of buttons you want to accept (and the format is annoying too.) I figured I'd try to tame this function a bit. pressed% = BDIALOG(message$, buttons%, title$, time%) message$ ' Dialog box body text. buttons% ' Buttons you want to accept. caption$ ' Dialog box title. time% ' Time (seconds) until dialog closes (0 or FALSE to disable.) pressed% ' The button pressed by the user, or 0 if timed-out. Some examples to help demonstrate the purpose of this function: PRESS%=BDIALOG("PRESS A QUICKLY!",#A,"HURRY HURRY",1) CHOICE%=BDIALOG("A for Game A, B for Game B?",#A OR #B,"Mode Select",FALSE) Note that this is a user DEF so there are no optional arguments like the built-in DIALOG forms; you have to specify every value. Function Code DEF BDIALOG(TEXT$,BTN%,TITLE$,TIME%) VAR BIT%,RES% 'prepare button type bitmask IF BTN% AND &B0011110000 THEN INC BIT%,1 IF BTN% AND &B0000001111 THEN INC BIT%,2 IF BTN% AND &B1100000000 THEN INC BIT%,4 BIT%=-BIT% IF !BIT% THEN RETURN 0 'exit if no valid choices REPEAT RES%=DIALOG(TEXT$,BIT%,TITLE$,TIME%) IF !RES% THEN 'timed out RETURN 0 ELSE 'convert output into the 'corresponding button bit RES%=1<<RES%-128 IF RES% AND &B00001111 THEN RES%=RES%<<4 ELSEIF RES% AND &B11110000 THEN RES%=RES%>>4 ENDIF 'return if the button pressed is acceptable RES%=RES% AND BTN% IF RES% THEN RETURN RES% ENDIF UNTIL FALSE 'forever/until we RETURN from this function END This function could be especially useful if wired up to a dialog menu builder or something like that. Just a building block for something more interesting. Note that you will get dialog flicker on some wrong/unaccepted presses. That's because the DIALOG built-in it's based on is bad. Posted Edited by snail_
  • #53 ✎ 131 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies This thread has got me thinking. We should have a thread like this (perhaps this very thread) where a user *asks* for a certain function and the community puts forth their methods and such. Then, all the solutions come together and fight to the death over their conciseness and feasibility. I've pulled a lot of useful stuff off this thread. Hell, it was quite like having a birthday; just getting a bunch of stuff I didn't know I wanted. I've thus integrated them into my own library, though there were times during my own coding endeavors when I needed a certain function and spent literally hours designing and debugging it. Some of those functions I've found here, too, like Simeon's string manipulation functions (actually, a great example). I'm aware that such a thread could defeat the purpose of having the user "learn for themselves," rather than being spoon fed the code and not know how or why it works. I believe our Programming Questions category has such a moral compass to it. Despite it, I think it would be less than harmful. Given the problem (desired function), people pool their knowledge to solve the problem, and we all walk away a little smarter. Posted
  • #54 ✎ 1464 12Me21 Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Second Year My account is over 2 years old Website Why don't you make the thread then? Posted
  • #55 ✎ 299 random_guy Video Games I like to play video games! Hobbies Reading I like to read books! Hobbies Halloween 2017 Contest Participant I participated in the SmileBASIC Source Halloween 2017 Contest! Programming Contest
    This thread has got me thinking. We should have a thread like this (perhaps this very thread) where a user *asks* for a certain function and the community puts forth their methods and such. Then, all the solutions come together and fight to the death over their conciseness and feasibility. I've pulled a lot of useful stuff off this thread. Hell, it was quite like having a birthday; just getting a bunch of stuff I didn't know I wanted. I've thus integrated them into my own library, though there were times during my own coding endeavors when I needed a certain function and spent literally hours designing and debugging it. Some of those functions I've found here, too, like Simeon's string manipulation functions (actually, a great example). I'm aware that such a thread could defeat the purpose of having the user "learn for themselves," rather than being spoon fed the code and not know how or why it works. I believe our Programming Questions category has such a moral compass to it. Despite it, I think it would be less than harmful. Given the problem (desired function), people pool their knowledge to solve the problem, and we all walk away a little smarter.
    we can use this thread for that if you like.
    Posted
  • #56 ✎ 131 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies
    Why don't you make the thread then?
    I would've, but I don't quite have any need to atm. I just put the idea of it out there to hear what response I'd get, and in the case someone else agrees and has something they'd like to figure out, they may start the thread.
    Posted
1 2 3