? Getting MML DATA ● SmileBASIC Source

Sign In

*Usernames are case-sensitive
Forgot my password

Getting MML DATA

MML DATA is usually formatted like: @SONG_NAME DATA "ABCDEFG" DATA "more MML" DATA "etc." DATA 0 This makes it easy to use BGMSETD, but since it uses string AND number data, it's hard to read it all using READ. You can't just do something like WHILE 1 READ DATA$ IF DATA$==0 THEN BREAK SONG$=SONG$+DATA$ WEND However, if you use READ on an undefined variable, its type will change to whatever type of data there is. DEF LREAD SONG$ OUT ENDED%,TEMP_ READ TEMP_ 'TEMP_ is undefined now, so you can READ any type of DATA IF (TEMP_||0)==3 THEN 'check if TEMP_ is a string INC SONG$,TEMP_ ENDED%=FALSE ELSE 'if TEMP_ isn't a string, there's no more MML DATA ENDED%=TRUE ENDIF END 'Main function DEF READSONG$() VAR SONG$ VAR ENDED% REPEAT LREAD SONG$ OUT ENDED%, UNTIL ENDED% RETURN SONG$ END You can now do something like: RESTORE @SONG PRINT READSONG$() @SONG DATA "T200" DATA ":0[CDEFGAB]" DATA ":1<[CDEFGAB]" DATA 0
3 votes
  • read
  • bgm
1 Comment(s) Chemicalex Chemicalex Drawing I like to draw! Hobbies Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength osu! Is Awesome! I love osu! Express Yourself is it useful though?