"The heart has reasons the mind knows nothing of."-Blaise Pascal
Pokemon X Friend Code:3883-5184-5725
Safari: Grass
Pokemon: Pansage, Sawsbuck (Spring), Gogoat.
Before I get into how to save/load MMLs via GRPs, I will make this completely clear. You cannot load an MML via strings that is greater than 2304 bytes long via BGMSET or 2560 bytes via BGMPLAY for loading strings. This is because PTC functions cannot have an excess of 10 parameters. BGMSET requires 1 parameter for the song number to set, making 9 strings you can use following it. BGMPLAY is completely for MML strings, so that is 10. Each string can hold up to 256 characters, so that makes it 2304 characters/bytes for 9 strings, and 2560 for 10.
I just typed this up without checking if it is correct, so if there are any errors when attempting to run it, I apologize. I was kinda in a hurry. Assume we are reading/writing to GRP1, using song #128 for testing/loading, and the label for the MML script is @MY_MML. We'll also assume you want to load but not necessary play immediately, so we are restricting length to 2304 bytes.
' First examine if the MML is valid and within the 2304 byte limit
BGMSETD 128,@MY_MML: 'If it errors here, then the MML is not valid (has errors)
RESTORE @MY_MML:MML_L=0:READ MML$
'Examine and add the length of each line to the overall. End when MML$=="0" (from DATA 0)
FOR I=1 TO (MML$!="0"):MML_L=MML_L+LEN(MML$):READ MML$:I=0:NEXT I
IF MML_L>2304 THEN ?"MML scripts too long!":END: 'If it is too long, it'll end the program
'Begin the procedure
'Initialize the data, and first write the length of the MML, splitting into 2 bytes
GPAGE 0,1,0:GIDX=2:GPSET 0,0,MML_L%256:GPSET 1,0,MML_L/256
'Restart from the beginning of the MML, and run through it all
RESTORE @MY_MML:READ MML$
'Continue writing until MML$==0
FOR I=1 TO (MML$!="0")
IF GIDX+LEN(MML$)>49152 THEN ?"Reached end of GRP, cannot continue":END
'Convert each character to a number (0-255), and write it in sequentially
FOR J=0 TO LEN(MML$)-1:GPSET (GIDX+J)%256,(GIDX+J)/256,ASC(MID$(MML$,J,1)):NEXT J
'Offset the write index and read the next string
GIDX=GIDX+LEN(MML$):READ MML$:I=0
NEXT I
RETURN
@LOAD_MML
IF !MML_DIM THEN DIM MMLA$(9):MML_DIM=1
'Initialize data, and grab the length first
FOR I=0 to 8:MMLA$(I)="":NEXT
GPAGE 0,1,0:GIDX=0:MML_L=GSPOIT(0,0)+GSPOIT(1,0)*256-1
'Begin OPERATION LOAD_MML!
FOR I=0 TO MML_L:MMLA$(I/256)=MMLA$(I/256)+CHR$(GSPOIT((GIDX+I)%256,(GIDX+I)/256)):NEXT I
BGMSET 128,MMLA$(0),MMLA$(1),MMLA$(2),MMLA$(3),MMLA$(4),MMLA$(5),MMLA$(6),MMLA$(7),MMLA$(8)
RETURN
I probably won't be working on Minecraft DS for the next few weeks. Two reasons: school, and a friend recently got killed. I won't go into detail about either of those because it can be considered off-topic. I don't need any responses to this post, because that can be considered off-topic too. Just wanted to post this if you notice me be quiet and not respond to posts. Thanks for understanding.
If Facebook, Myspace, Twitter, Instagram, and Snapchat were all destroyed, 90% of teens would go insane. If you're one of the 10% that would be laughing at them, copy & paste this into your signature and hope it happens.
@TexMurphy Thanks!, By the looks of it, is it just displaying the SCR layers and reading the grp's cols as collision?
Collision can be done by checking the background SCR tiles with the position of the sprite. The problem is: the sprite moves one pixel at a time but the background moves 8 pixels or one tile at a time. The collision point for the tile is in the upper left of each tile. Therefore, the sprite may walk inbetween these tiles. One can span 8 places and look for the tile like my miku example. I found it easier to match one tile to one number in an array. But, setting up an array for a large map takes alot of DATA statements. It is also hard to know where I am in the DATA statement to where the SCR tiles are. So I created Aster2 program to visually place graphic color blocks on the tiles. The program takes those blocks and saves them as a single pixel in a GRP file. The game program loads the GRP pixels and copies the color numbers into the array without using DATA statements. The neat thing about this is that I can use mupliple colors for different things like sound, death spots, collision, etc. When the program runs it test with IF statements to see what color matches the number its looking for.
@Discostew I never thought you could do that with FOR loops!
FOR I=1TO (condition)STEP 0
NEXT
That helps a lot. I guess it's because if the condition is met, it returns a 1, completing the loop. This is like a WHILE loop in PTC! Except you'd have to flip the condition for it to work. So would these two codes work the same?
FOR I=1TO (NUMBER==5)STEP 0
LINPUT NUMBER$
NUMBER=VAL(NUMBER$)
NEXT
And this pseudocode:
while (number != 5){
number = ToVar(GetInput)
}
And one last question: are new lines or rebuttles faster? (A rebuttle is a colon in SB.) And by how much? If rebuttles are faster, would it be worth going through my entire code and rebuttle-izing?
EDIT: For people like @Randomous, @Hansausage, and anyone else who uses C#, should I create a PTC class? It'd work like this (a GLINE command):
If Facebook, Myspace, Twitter, Instagram, and Snapchat were all destroyed, 90% of teens would go insane. If you're one of the 10% that would be laughing at them, copy & paste this into your signature and hope it happens.
@IAmAPersson Rebuttals are actually slightly slower. I assume it's because it adds more work to the parser. Use only with IF statements and if you feel you're going to hit the 9999 line limit. Having tested that out, I'll have to go through my code when I'm done with the project because I use an immense number of rebuttals. Then again, I'm at about 7500 lines of code and still not done.
Also, I never realized using STEP 0 could actually work in these scenarios because of how I understood FOR/NEXT loops. STEP (positive number) would indicate an exit of the loop if the iteration number is greater than the number being counted to, while STEP (negative number) would indicate an exit if the iteration is less than. I assumed STEP 0 was neither of these so it could not tell whether it should go up or down. Perhaps SB understands 0 as a positive number, but what's odd is that, based on tests, it considered -0 as a positive number as well.
One last thing about this method. This method of while loops is quite a bit faster than what I listed in my code above because it doesn't have to parse the line to reset the iteration variable (which does assigning, and that is slow in SB).
Discostew
3DS Friend Code: 4425-1477-0127 | Nintendo Network ID: Discostew
Is there a PC program that can take an image and convert it to a GRP file or qr code?
PTCUtilities. That's what I use for porting Minecraft DS's textures, backgrounds, etc.
If Facebook, Myspace, Twitter, Instagram, and Snapchat were all destroyed, 90% of teens would go insane. If you're one of the 10% that would be laughing at them, copy & paste this into your signature and hope it happens.
If Facebook, Myspace, Twitter, Instagram, and Snapchat were all destroyed, 90% of teens would go insane. If you're one of the 10% that would be laughing at them, copy & paste this into your signature and hope it happens.
@Discostew I never thought you could do that with FOR loops!
FOR I=1TO (condition)STEP 0
NEXT
That helps a lot. I guess it's because if the condition is met, it returns a 1, completing the loop. This is like a WHILE loop in PTC! Except you'd have to flip the condition for it to work. So would these two codes work the same?
FOR I=1TO (NUMBER==5)STEP 0
LINPUT NUMBER$
NUMBER=VAL(NUMBER$)
NEXT
And this pseudocode:
while (number != 5){
number = ToVar(GetInput)
}
And one last question: are new lines or rebuttles faster? (A rebuttle is a colon in SB.) And by how much? If rebuttles are faster, would it be worth going through my entire code and rebuttle-izing?
EDIT: For people like @Randomous, @Hansausage, and anyone else who uses C#, should I create a PTC class? It'd work like this (a GLINE command):
ptc.gLine(x1, y1, x2, y2, color);
and a PRINT command:
ptc.print("hi!");
Would anyone use it?
Wait what? That would be pretty amazing..
This may "Seem" off-topic but would anyone care for my Windows Forms app for rock paper scissors?
@SmokedSausage so you'd use the PTC class? I'm thinking of doing
class SmileB { }
Good name? Bad name? I'd use the PTC class.
Sorry for the off-topicness.
If Facebook, Myspace, Twitter, Instagram, and Snapchat were all destroyed, 90% of teens would go insane. If you're one of the 10% that would be laughing at them, copy & paste this into your signature and hope it happens.
I'm just going to say what I plan to add to rayspace more as a reminder to me but:
Campaign wise:
9 missions
mission 1 will take place in a forest
mission 2 will take place in a forerunner ruins
mission 3 will take place in an unsc base
mission 4 will take place in a desert
mission 5 will take place in icy mountains
mission 6 will take place in an covenant ship
mission 7 will take place in an unsc ship
mission 8 will take place in a covenant base
mission 9 will be the last mission haven't decided how to end it yet
Firefight wise:
multiple maps
a few enemy types
5 waves
settings and junk
Multiplayer wise:
Not real multiplayer everyone are bots
a few maps that work with every gametype
few gametypes
settings and junk
fun
hey guy's,this time im using a wii to comment.what are the odds XD!!! anyway,i still need some help,you know I can't do this alone guys.im working on alot of sandbox games.there all 2d though n. and there are alot of secret games that you won't know of until its released. and @calk4mainic can you give the qrs for your ratracting engien? it would be cool if you did.
email:[email protected]
if facebook,myspace,instagram and twitter were all shut down, 90% of the teenage population would go insane. if your one of the 10% that would be laughing at them, copy&past this to your signature and hope it happens. Wait... NO!
hey guy's,this time im using a wii to comment.what are the odds XD!!! anyway,i still need some help,you know I can't do this alone guys.im working on alot of sandbox games.there all 2d though n. and there are alot of secret games that you won't know of until its released. and @calk4mainic can you give the qrs for your ratracting engien? it would be cool if you did.
It'd be easier for us to read your comments if you'd use basic spelling and grammar. It was very hard to read your post to be honest.
If Facebook, Myspace, Twitter, Instagram, and Snapchat were all destroyed, 90% of teens would go insane. If you're one of the 10% that would be laughing at them, copy & paste this into your signature and hope it happens.
Forums
Topic: Petit Computer
Posts 8,981 to 9,000 of 9,620
Please login or sign up to reply to this topic