DSiWare Forum

Topic: Petit Computer

Showing 721 to 740 of 2,726

AuthorMessage
Avatar

ramstrong

721. Posted: Mon 1st Oct 2012 16:12 BST

Samples of different loops. There's GPUTCHR example for BANNER program to illustrate fine scrolling.

http://ramstrong.blogspot.com/2012_10_01_archive.html

Petit Computer Journal
http://ramstrong.blogspot.com
(New) Art Academy pictures
https://skydrive.live.com/redir?resid=3768290E373AEE41!300

3DS Friend Code: 1091-7596-4855

AuthorMessage
Avatar

portealmario

722. Posted: Mon 1st Oct 2012 19:11 BST

Ok, so is there any possible way to save various variable to MEM$?

Edited on Mon 1st October, 2012 @ 19:12 by portealmario

meng 😐
3ds friend code:1762-2769-7142

AuthorMessage
Avatar

Morphtorok

723. Posted: Mon 1st Oct 2012 20:33 BST

@portealmario: Yeah, just cram all the variables you want on MEM together and find a way to load them again.

For example, what I do in Petit Farm could be seen as doing this:

1- Decide what value to store and transform it to string (store its contents on another $ variable with STR$ (we will use TEMP$ and MONEY for this example))
2- Identify how many digits or characters can that value at max (example: The MONEY variable tops at 99999, that's 5 digits)
3- If the variable TEMP $ has less characters (LEN) than it can have, add enough extra characters for it to meet the quota (If our MONEY variable was, say 230, that's only 3 characters and we need 5, so we add two 0s and it becomes 00230.
4-Save that to MEM$. (MEM$=MEM$+TEMP$)
5- Do the same thing for every other variable.

At the moment of loading, you know where each variable should be stored on the MEM$ variable and get the value with MID$.
(Example: if the first value I stored was the one for MONEY, then MONEY=VAL(MID$(MEM$,0,5)), that means that MONEY will take the numeric value of whatever is stored in the first 5 charaters of MEM$)

There are other methods too.
Written on my phone, sorry if it is confusing.

Oh look! A Morphloggery. Oh, and a Morphsite too.

3DS Friend Code: 0173-1330-0080

AuthorMessage
Avatar

Discostew

724. Posted: Mon 1st Oct 2012 20:46 BST

portealmario wrote:

Ok, so is there any possible way to save various variable to MEM$?

Here is my idea on the matter. You can combine a bunch of strings together into a single string (convert numbers to strings with STR$), and separate each one in the final string with a character you wouldn't use. Remember, up to 256 characters can be held in a string, including MEM$. For this example, assume "%" is the character you plan to never use in a string (and I mean never). Decide what character you plan to be the separator character in your own code.

MYSTR$=STR$(VAR1)+"%"+STR$(VAR2)
MYSTR$=MYSTR$+"%"+STR$(VAR3)
MEM$=MYSTR$
SAVE "MEM:SAVE"

Then when you want to retrieve the variables, you use INSTR to look for that particular character used to separate the strings in the first place, and grab the sides with LEFT$ and RIGHT$ of the position retrieved by INSTR. You can store the results into an array if you want so you can deal with each one individually afterwards.

DIM MYARR$(100)
LOAD"MEM:SAVE"
CURELEMENT=0
MYSTR$=MEM$
@SPLIT
SPLITPOS=INSTR(MYSTR$,"%")
IF SPLITPOS==-1 GOTO @ENDSPLIT
MYARR$(CURELEMENT)=LEFT$(MYSTR$,SPLITPOS)
MYSTR$=RIGHT$(MYSTR$,LEN(MYSTR$)-SPLITPOS-1)
IF LEN(MYARR$(CURELEMENT))>0 THEN CURELEMENT=CURELEMENT+1
GOTO @SPLIT
@ENDSPLIT

From there, you decide what is meant to be a number and use VAL on those values. The above code hasn't been tested, but the idea is there.

edit
lol, the "code" tag did not like my stuff, putting it all onto one line instead of separating them to different lines.

Edited on Mon 1st October, 2012 @ 20:52 by Discostew

"What fun is there in making sense?"

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

AuthorMessage
Avatar

petitgamer

725. Posted: Mon 1st Oct 2012 21:22 BST

I wish they made it keyboard compatable so you don't have to tap with the stylus

3ds FC is 1934-1168-4523
fyi lucas is better than ness in any way shape or form.That is a coldhard fact.

AuthorMessage
Avatar

petitgamer

726. Posted: Mon 1st Oct 2012 21:27 BST

hello sprite I need help with making stuff move I can't get it to work.
oh and yeah you're right DON'T DISS THE GOD OF PROGRAMING!!!!!!!!!!

3ds FC is 1934-1168-4523
fyi lucas is better than ness in any way shape or form.That is a coldhard fact.

AuthorMessage
Avatar

GrabSomeEyes

727. Posted: Mon 1st Oct 2012 21:30 BST

@petitgamer ... use PTCUtilites or Notepad ++ or something. It isn't that hard to program through your computer.
http://micutil.com/ptcutilities/top_e.html
And you need to tell us how you're having problems, other wise we can't help you much.

Eos OS: http://conlogxl.forumotion.com/t12-eos-os-v10
3DS FC: 3695-0514-5044

AuthorMessage
Avatar

petitgamer

728. Posted: Mon 1st Oct 2012 22:01 BST

my problem is I CAN'T PROGRAM GRABSOMEEYES

3ds FC is 1934-1168-4523
fyi lucas is better than ness in any way shape or form.That is a coldhard fact.

AuthorMessage
Avatar

petitgamer

729. Posted: Mon 1st Oct 2012 22:04 BST

I'm going to post some battle sprites as soon as I figure out to post QR codes does anyone know?

Edited on Tue 2nd October, 2012 @ 00:38 by petitgamer

3ds FC is 1934-1168-4523
fyi lucas is better than ness in any way shape or form.That is a coldhard fact.

AuthorMessage
Avatar

Sprite

730. Posted: Mon 1st Oct 2012 22:07 BST

Then learn to and come back later

I'm not saying let's kill all the stupid people, I'm just saying let's take off the warning labels, and see what happens. Friend Code: 1075-1228-4183
Yeah I got problems. DEAL WITH IT!
(o0)
/_

AuthorMessage
Avatar

portealmario

731. Posted: Tue 2nd Oct 2012 01:15 BST

what circumstances make "VAL" an illegal function call?

Edited on Tue 2nd October, 2012 @ 02:17 by portealmario

meng 😐
3ds friend code:1762-2769-7142

AuthorMessage
Avatar

Sprite

732. Posted: Tue 2nd Oct 2012 01:32 BST

I belive it stands for string

I'm not saying let's kill all the stupid people, I'm just saying let's take off the warning labels, and see what happens. Friend Code: 1075-1228-4183
Yeah I got problems. DEAL WITH IT!
(o0)
/_

AuthorMessage
Avatar

Morphtorok

733. Posted: Tue 2nd Oct 2012 04:10 BST

VAL transforms strings to numeric.

Example:
NUMBER=VAL(STRING$)

I guess using a numeric variable on it or something else will make it fail.

Oh look! A Morphloggery. Oh, and a Morphsite too.

3DS Friend Code: 0173-1330-0080

AuthorMessage
Avatar

ramstrong

734. Posted: Tue 2nd Oct 2012 04:30 BST

Discostew wrote:

portealmario wrote:

Ok, so is there any possible way to save various variable to MEM$?

Here is my idea on the matter. You can combine a bunch of strings together into a single string (convert numbers to strings with STR$), and separate each one in the final string with a character you wouldn't use.

That looks to be an overly complicated solution to a simple problem. I like Morphtroid solution better. Then again, I'm a simpleton. If it's not simple, I'm not interested. Check out my implementation of Morphtroid Algorithm. It's doable in 6 lines.

Keeping in mind that a variable, ignoring negative, is 6 digit max, we can fit 42 values in a string, so let's do that. MEMVAR[] is the array to hold all variables.

'Init
DIM MEMVAR[42]
MEM$="x"*256

'SAVE
FOR I=0 TO 41:MEM$=SUBST$(MEM$,I*6,6,RIGHT$("000000"+STR$(MEMVAR[I]),6)):NEXT
SAVE "MEM:TEST1"

'LOAD
LOAD "MEM:TEST1"
FOR I=0 TO 41:MEMVAR[I]=VAL(MID$(MEM$,I*6,6)):NEXT

Alternatively,
'SAVE
MEM$="":FOR I=0 TO 41:MEM$=MEM$+RIGHT$("000000"+STR$(MEMVAR[I]),6):NEXT

Edited on Tue 2nd October, 2012 @ 04:45 by ramstrong

Petit Computer Journal
http://ramstrong.blogspot.com
(New) Art Academy pictures
https://skydrive.live.com/redir?resid=3768290E373AEE41!300

3DS Friend Code: 1091-7596-4855

AuthorMessage
Avatar

ramstrong

735. Posted: Tue 2nd Oct 2012 04:35 BST

portealmario wrote:

what circumstances make "VAL" an illegal function call?

Don't know. I got Missing operand, Type Mismatch, and Syntax Error. Illegal function call probably means the error lies somewhere else. Can you post a short code, preferably less than 7 lines, that duplicates the error?

Petit Computer Journal
http://ramstrong.blogspot.com
(New) Art Academy pictures
https://skydrive.live.com/redir?resid=3768290E373AEE41!300

3DS Friend Code: 1091-7596-4855

AuthorMessage
Avatar

Morphtorok

736. Posted: Tue 2nd Oct 2012 04:51 BST

This is a nifty idea I read on another forum:
You can also save data with GRP files! (that's the correct file type, right?)
Colors range from 0 to 255, more than enough space for you to assing a color for each number from 0 to 9 and each character from A to Z and other things.
GRP files have enough space for 255*191 pixels, that's 191 times the space you have in a MEM file.

Just put pixels on the screen in the correct order and save them as a GRP file, then you can load it and decipher it back to numbers and strings.

It's slower and harder, but it sounds so cool.

Oh look! A Morphloggery. Oh, and a Morphsite too.

3DS Friend Code: 0173-1330-0080

AuthorMessage
Avatar

Discostew

737. Posted: Tue 2nd Oct 2012 05:25 BST

ramstrong wrote:

That looks to be an overly complicated solution to a simple problem.

Yeah, it was more of a general idea that anyone could use without having to know the length of data or at what character position in the string. Just a combiner for saving, and a parser for loading.

"What fun is there in making sense?"

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

AuthorMessage
Avatar

portealmario

738. Posted: Tue 2nd Oct 2012 05:56 BST

Oh yea! I just found a very well done 3D game called "raycaster" made on petit computer! I figured out how to edit the map! Just a little added to this could make a "petitcraft" in 3D! I can make rooms and shaped and various other things by editing thhe map, you should try! 1=block, 0=air. Goto @mapdata

Edited on Tue 2nd October, 2012 @ 16:59 by portealmario

meng 😐
3ds friend code:1762-2769-7142

AuthorMessage
Avatar

portealmario

739. Posted: Tue 2nd Oct 2012 06:12 BST

@ramstrong sample code:
A=VAL(MID$(MEM$,16,20))

Error:
"Illegal function call (45,VAL)"

Edit:
I'm probably going to just scrap the memory saving feature for now and work on other features(like a botton based menu system). i am also working on some console games, which I will make sure I master before I start using sprites.

Edited on Tue 2nd October, 2012 @ 18:38 by portealmario

meng 😐
3ds friend code:1762-2769-7142

AuthorMessage
Avatar

GrabSomeEyes

740. Posted: Tue 2nd Oct 2012 20:48 BST

@petitgamer You asked how to program on a computer. I answered your question. Sorry.
@portealmario Do you mean this one? http://wiki.hosiken.jp/petc/?Toukou%2FRAYCAST%20MAZE
I like it, but it's got elements that annoy me.
Also, that bug flight one pissed me off. A lot.

Eos OS: http://conlogxl.forumotion.com/t12-eos-os-v10
3DS FC: 3695-0514-5044