? DATA help (Page 1) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password
What's going on?? See: Site Update March 2022

DATA help

  • #1 ✎ 136 zagg2000 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Third Year My account is over 3 years old Website Video Games I like to play video games! Hobbies How do i use DATA (and what ever els) to put a SP on screen? This is what i mean. DATA "B" B is the bom sprite. when i put a B In Those "" i want a bomb to show up on screen. and the X,Y is according to where in the "" its at. Posted
  • #2 ✎ 1884 12Me21 Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself put a label before your DATAs, like this: @LABELNAME DATA "B",10000,"etc." DATA ... ... then use RESTORE @labelName to start reading the DATA at that label: use READ variableName to read a single value from the DATA (you'll probably put it in some kind of loop) you can also READ multiple values at once, like: READ firstVariable, secondVariable, ... Posted
  • #3 ✎ 136 zagg2000 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Third Year My account is over 3 years old Website Video Games I like to play video games! Hobbies Could you possibly make a quick Program based on what i sed earlyer? Please? Posted
  • #4 ✎ 1884 12Me21 Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Can you give an example of what your DATA would look like? Posted
  • #5 ✎ 136 zagg2000 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Third Year My account is over 3 years old Website Video Games I like to play video games! Hobbies Well I dont realy know...im new to working with DATA. all i wont you to do is make a small program that places a sprite As may Bs i have in the "". like what the system Game Gunner uses. Posted
  • #6 ✎ 136 zagg2000 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Third Year My account is over 3 years old Website Video Games I like to play video games! Hobbies 12ME21? Posted Edited by zagg2000
  • #7 ✎ 131 raimondz First Week Joined in the very first week of SmileBASIC Source Website Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Night Person I like the quiet night and sleep late. Express Yourself You can set the definition number and the position on the data and the load it on other part of your code. Example: 'Array that hold the sprites instances. VAR sprites[0] sprites=loadSprites() 'If you want to reload the sprites, then do the following clearSprites sprites sprites=loadSprites() '================================================ DEF loadSprites() VAR sprites[0] VAR SP,DN,X,Y RESTORE @SPRITES WHILE 1 READ DN,X,Y IF DN==-1 THEN BREAK SP=SPSET(DN) SPOFS SP,X,Y PUSH sprites,SP WEND RETURN sprites END DEF clearSprites ARR[] VAR SP WHILE LEN(ARR)>0 SP=POP(ARR) SPCLEAR SP WEND END @SPRITES DATA 0,200,100 DATA 1,80,80 DATA -1,0,0 Posted
  • #8 ✎ 136 zagg2000 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Third Year My account is over 3 years old Website Video Games I like to play video games! Hobbies DEF without END Posted
  • #9 ✎ 136 zagg2000 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Third Year My account is over 3 years old Website Video Games I like to play video games! Hobbies also, where do i put the DATA "B" for the sprite? Posted
  • #10 ✎ 131 raimondz First Week Joined in the very first week of SmileBASIC Source Website Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Night Person I like the quiet night and sleep late. Express Yourself
    DEF without END
    I can't see your code but that means that you didn't close a DEF with an "END" sentence.
    also, where do i put the DATA "B" for the sprite?
    I didn't. You can't set a sprite with a string. (However, you can make a static map data structure to store sprite definition number(value) asosiated with strings(key).) ? spriteMap("B") DEF spriteMap(S$) IF !CHKLABEL("@"+S$) THEN RETURN -1 'NO RESULT GOTO "@"+S$ @A RETURN 0 @B RETURN 1 END
    Posted
  • #11 ✎ 136 zagg2000 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Third Year My account is over 3 years old Website Video Games I like to play video games! Hobbies What if i dont wanna print the RESULT? Posted
  • #12 ✎ 1093 Yolkai Head Admin
    What if i dont wanna print the RESULT?
    remove the question mark
    Posted
  • #13 ✎ 136 zagg2000 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Third Year My account is over 3 years old Website Video Games I like to play video games! Hobbies i did. it errored. Posted
  • #14 ✎ 136 zagg2000 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Third Year My account is over 3 years old Website Video Games I like to play video games! Hobbies NSEXX3KJ Please download this and look at the code. Posted
  • #15 ✎ 254 answer Great Page Hidden Achievements Third Year My account is over 3 years old Website Deep Sleep Hidden Website
    Remove the question mark
    i did. it errored.
    You can't have a function with a return value and give it to nothing, something has to eat it DEF EAT V:END DEF myDEF() RETURN 0 END EAT myDEF()
    Posted Edited by answer