DSiWare Forum

Topic: Petit Computer

Showing 721 to 740 of 9,498

AuthorMessage
Avatar

Morphbug

721. Posted:

@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! eShop Gurus.

3DS Friend Code: 0173-1330-0080 | Nintendo Network ID: Abgarok

AuthorMessage
Avatar

Discostew

722. Posted:

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 by Discostew

"What fun is there in making sense?"
Lazer Light Studios - Home of the MM2 PTC project

Pokemon 3DS Friend Safari - Ice - Spheal, Sneasel, Lapras

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

AuthorMessage
Avatar

petitgamer

723. Posted:

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

724. Posted:

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

725. Posted:

@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

726. Posted:

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

727. Posted:

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

Edited on 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

728. Posted:

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

AuthorMessage
Avatar

portealmario

729. Posted:

what circumstances make "VAL" an illegal function call?

Edited on by portealmario

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

AuthorMessage
Avatar

Sprite

730. Posted:

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

AuthorMessage
Avatar

Morphbug

731. Posted:

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! eShop Gurus.

3DS Friend Code: 0173-1330-0080 | Nintendo Network ID: Abgarok

AuthorMessage
Avatar

ramstrong

732. Posted:

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 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

AuthorMessage
Avatar

ramstrong

733. Posted:

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
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

AuthorMessage
Avatar

Morphbug

734. Posted:

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! eShop Gurus.

3DS Friend Code: 0173-1330-0080 | Nintendo Network ID: Abgarok

AuthorMessage
Avatar

Discostew

735. Posted:

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?"
Lazer Light Studios - Home of the MM2 PTC project

Pokemon 3DS Friend Safari - Ice - Spheal, Sneasel, Lapras

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

AuthorMessage
Avatar

portealmario

736. Posted:

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 by portealmario

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

AuthorMessage
Avatar

portealmario

737. Posted:

@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 by portealmario

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

AuthorMessage
Avatar

GrabSomeEyes

738. Posted:

@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

AuthorMessage
Avatar

portealmario

739. Posted:

I am having trouble with a jumping mechanism and gravity in ny game, any suggestions?

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

AuthorMessage
Avatar

portealmario

740. Posted:

@GrabSomeEyes no, a different one, with normal walking

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