Forums

Topic: Petit Computer

Posts 2,741 to 2,760 of 9,620

ramstrong

randomouscrap98 wrote:

@ramstrong The program isn't able to tell the size of the images until it begins stitching, so I suppose I could preread all the images as soon as the user selects a directory, but then the program may hang on slower computers. That's a good idea though, so I'll see what I can do about adding it. And I didn't know you were talking about the number of images, I'm sorry! I know PTCUtilities generates less images, but I still like using the smileboom one (IDK why). I think at some point someone said that Petit Computer has 10mb reserved for files, so if each GRP is only 50k, you can probably (maybe) save around 200 of them.

No need to be sorry. It's a common mistake. Oh, you can just provide a size preview button. I don't have to have the size preview automatically on, if that helps. So, you just do the stitching, but not save the image. You can even have it as an in-between steps after pushing stitch button and saving images, saying, "The image will be 400x700. OK? Cancel?" for example. Thanks again for a great program. You're a life saver!

EDIT: Come to think of it, I think a dialog box OK/CANCEL before saving would be ideal. I hope that's not too difficult to implement.

Edited on by ramstrong

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

Discostew

randomouscrap98 wrote:

TLDR; Don't do this:

FOR I=0 TO 100
IF <WHATEVER> THEN <DO SOMETHING>:GOTO @ENDLOOP
NEXT
@ENDLOOP

Note: This is perfectly acceptable (if not a little messy) in pretty much all languages that are compiled to machine code (and support unconditional jumps to a fixed location), because the machine's not going to care about what loop you're in.

I made an entire argument, assuming you said "Do this" when you actually said "Don't do this", so, it has been deleted, lol.

But anyways, a way around this can be done like so...

FOR I=0 TO 100
IF <WHATEVER> THEN <DO SOMETHING>:I=100:GOTO @ENDLOOP
@ENDLOOP
NEXT

Basically, I throw the @ENDLOOP label into the block, and when the comparison is true, it does what it needs to, then forces the iterating variable to the max of the FOR/NEXT loop, and then goes to the label. This will allow it to complete the loop, iterating the variable by one more, and examine the variable if it needs to loop again (which it won't), so it skip all code until it reaches the corresponding NEXT statement and go past it.

Unless I'm mistaken, you can't put a NEXT statement in the IF line to get it to jump out of the block (and remove the label and maxing the iterating assignment) because I think when it does exit the FOR/NEXT block, PTC scans for the next NEXT statement, no matter where it is (even in an IF statement), so if it find one in an IF statement, it will proceed right after that statement, resulting in staying in the block and reaching the true NEXT statement, resulting in a "NEXT before FOR" error. I can't check it right now, but I believe this is what will happen in that scenario.

Edited on by Discostew

Discostew

3DS Friend Code: 4425-1477-0127 | Nintendo Network ID: Discostew

ramstrong

Discostew wrote:

Unless I'm mistaken, you can't put a NEXT statement in the IF line to get it to jump out of the block (and remove the label and maxing the iterating assignment) because I think when it does exit the FOR/NEXT block, PTC scans for the next NEXT statement, no matter where it is (even in an IF statement), and then will proceed right after that statement, resulting in staying in the block and reaching the true NEXT statement, resulting in a "NEXT before FOR" error. I can't check it right now, but I believe this is what will happen in that scenario.

I did loops experimentation on Petit Computer Journal#9

Yes, it will happen as you say, but simply append GOTO statement after NEXT, and you're good to go!

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

randomous

Hi @Discostew. I was just about to point out that I said "Don't do this" when I thought to myself, "You know, I should refresh the page," and then your post was magically different only 3 seconds after you wrote it lol. OK, that was a hyperbole, it was really 3 minutes. Anyway, I believe you're right; I've never been able to use NEXT more than once in a FOR loop (for instance, in a condition). Instead, I just increment the loop counter. But yeah, you're absolutely right: your way is the right way to do this in Petit Computer. In my application, I was only exiting to save some computations, but it's only like 400 per second. In this case, I decided to just let the for loop go through all its iterations instead.

randomous

ramstrong

randomouscrap98 wrote:

Hi @Discostew. I was just about to point out that I said "Don't do this" when I thought to myself, "You know, I should refresh the page," and then your post was magically different only 3 seconds after you wrote it lol. OK, that was a hyperbole, it was really 3 minutes. Anyway, I believe you're right; I've never been able to use NEXT more than once in a FOR loop (for instance, in a condition). Instead, I just increment the loop counter. But yeah, you're absolutely right: your way is the right way to do this in Petit Computer. In my application, I was only exiting to save some computations, but it's only like 400 per second. In this case, I decided to just let the for loop go through all its iterations instead.

Oh, you mean something like this?

A$="HELLO SAILOR!"
FOR I=0 TO LEN(A$)-1
IF INSTR("AEIOU",MID$(A$,I,1))>=0 THEN NEXT
? MID$(A$,I,1);
NEXT
?:?"DONE!"

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

Pixelrobin

Ok, I see where you are going @ramstrong. Thanks! One more question: Could someone give me an example of GCOPY copying the console screen then saving it as a GRP? Code speaks better than explanation. Thanks!

Everybody do a chirp. CHIRP.

3DS Friend Code: 3007-9228-5126

ramstrong

Bluerobin2 wrote:

Ok, I see where you are going @ramstrong. Thanks! One more question: Could someone give me an example of GCOPY copying the console screen then saving it as a GRP? Code speaks better than explanation. Thanks!

?? GCOPY does not copy console screen. Maybe you're thinking reading the console character-by-character, then GPSET it on GRP?

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

Pixelrobin

@ramstrong yes, but I want to copy the color of the character, Not the character itself. In my case, the characters are all squares but different colors.

Everybody do a chirp. CHIRP.

3DS Friend Code: 3007-9228-5126

ramstrong

Bluerobin2 wrote:

@ramstrong yes, but I want to copy the color of the character, Not the character itself. In my case, the characters are all squares but different colors.

OK, sorry. I misunderstood. You could've show some code to explain it. I assume this is what you mean:
‘COLOR TEST
@INIT
CLS
LL=5:HL=12
@DRAWLOOP
X=FLOOR(TCHX/8):Y=FLOOR(TCHY/8)
IF TCHST==FALSE GOTO @DRAWLOOP
FOR IX=0 TO 31
FOR IY=0 TO 22
D=SQR(ABS((IX-X)(IX-X))+ABS((IY-Y)(IY-Y)))
C=65
IF D>LL AND D<HL THEN C=65+D
COLOR C-63
LOCATE IX,IY:?CHR$(C);
NEXT IY:NEXT IX
VSYNC 1:IF BTRIG() GOTO @SAVE
GOTO @DRAWLOOP

@SAVE
?”DONE”
END

And your question is what to put in @SAVE subroutine so that you can save the color info, instead of the character info. Is that right?
Well, I have no answer for you. Sorry. There are 2 workarounds off the top of my head:(1) maintain an array holding the color info as you draw them. (2) Use BG screen, assuming one is available.

EDIT
Not off top of my head, but just use GFILL to draw it. You're working on Pixel Art, I assume?

Edited on by ramstrong

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

shinydragonmist

so far i have made a text program that beeps and endlessly repeat itself. and i also but 2 programs i found on here together they were pong and also the pokemon bike mml
all i have to do is start pong pause it and unpause it and the music will play i know that it is just basicnoop stuff but that is as far as i have gotten gotten so far i am going to try to get better at it and make my own program that is good enough for me to post. hope it will be soon but it probably wont so far my idea is for it to be a text adventure. thanks for all the programs you have posted and made

3ds friend code ; 0774-4507-6022
pokemon white 2 friend code: 1078-1500-5443

MrSirr

ramstrong wrote:

MrSirr wrote:

I'm making a poker game and trying to make the cards is easy. The suits? HARD. Here's the coding, what did I do wrong with the suits?

http://img195.imageshack.us/img195/6375/qr0.png

V$="123456789TJQKA"
S$="HDSC"
@LOOP
C=RND(14*4)
VSYNC 1
V=FLOOR(C/4):S=FLOOR(C%4)
?MID$(V$,V,1);MID$(S$,S,1);" "
GOTO @LOOP

Thanks, thats really good, but I just got on here to say nvm, cuz i figured it out. But thx anyway! u seem to be good at basic. Im kindof a beginner. lol

MrSirr

Pixelrobin

@ramstrong One is available. I assume I could use the BG screen. Then what?
I appreciate all of your help. Thank you.

Everybody do a chirp. CHIRP.

3DS Friend Code: 3007-9228-5126

ramstrong

Bluerobin2 wrote:

@ramstrong One is available. I assume I could use the BG screen. Then what?
I appreciate all of your help. Thank you.

You need to work on the BG elements to just solid colors for different colors.

Replace
LOCATE IX,IY:?CHR$(C)
with
BGPUT1,IX,IY,C,0,0,0

Replace BTRIG() with BUTTON(0) or you'll have a hard time saving.

@SAVE
PNLTYPE "OFF"
FOR IX=0 TO 31
FOR IY=0 TO 22
BGREAD(1,IX,IY)C,P,H,V '{-READ CHARACTER
PNLSTR IX,IY,CHR$(C)
NEXT IY:NEXT IX
WAIT 600
END

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

shinydragonmist

combined a magic 8ball program i found on the nintendolife qr code sharing thread with the legend of zelda main screen song i found on here i think the program name for the song is tlozsong but i might have renamed it thanks for this one i figured out how to use the copy and paste for this one thanks for the programs still trying to learn but boredom got a hold on me so i searched for programs for it found a maic 8ball program and got it thought it could iuse some music so i combined it with song program i already found here and got it to works thanks guys keep it up

3ds friend code ; 0774-4507-6022
pokemon white 2 friend code: 1078-1500-5443

mystman12

Well, now that my school is 100% complete, I have plenty of time to start working on my game again! Hoepfully I can post some QR codes of the game soon(ish[kinda sorta{not for quite a while}])

I like makin' games!
Future Pinball games!
Petit Computer games!!
and SmileBASIC games!
Waiting for Kirby Air Ride 2. One day, it will come. One day...

3DS Friend Code: 0259-0292-5888 | Nintendo Network ID: mystman12 | Twitter:

Please login or sign up to reply to this topic