Forums

Topic: Petit Computer

Posts 1,021 to 1,040 of 9,620

tiger667

I am having trouble with a code block, I need to give access to (and read input from) a keyboard without pausing the rest of the program (a timer needs to keep updating in real time). I can get the first menu option to go through, but it keeps assigning the enter key to the variable and I don't know how to stop it (it will also hold all data input before INKEY$ is used, ie if I press 0 five times before it can respond it will put all five 0s when it updates and reads INKEY$) here is the block

'TEXT$ GETS SET TO "" BEFORE THE LOOP THAT CALL IN
@KEYCHECK
IF !TCHST THEN RETURN
IF KEYBOARD=15 AND TEXT$="" THEN (SET MENU THINGS FOR DISPLAYING): VSYNC 2:RETURN 'entire thing is if backspace is pressed when no text 'is entered, vsync was there to try and stop the problem.
IF KEYBOARD=15 THEN TEXT$=LEFT$(TEXT$,LEN(TEXT$)-1):VSYNC 2:RETURN 'this allows them to actually backspace when they make a mistake.
IF KEYBOARD=60 THEN CHOICE$=TEXT$:TEXT$="":VSYNC 2:RETURN 'for entry
IF (ENTER KEYBOARD LIMITS FOR NUMBERS AND LETTERS ACROSS MULTIPLE LINES) THEN TEXT$=TEXT$+INKEY$():VSYNC 2
(EXAMPLE OF ABOVE FOR NUMBERS: IF KEYBOARD >=2 AND KEYBOARD<=11 THEN...) 'I put these in to try and stop the enter key being added to the 'TEXT$ variable, but it did nothing
RETURN

the TEXT$ variable is printed elsewhere in the program within the loop, that works fine, CHOICE$ is used as the total input.
the problem is that because I check for what CHOICE$ is exactly, I can't get past the first menu, it would also be likely to cause problems when I want to set other variables to CHOICE$ at the end of the menu lines.

Edited on by tiger667

tiger667

Javo118

tiger667 wrote:

I am having trouble with a code block, I need to give access to (and read input from) a keyboard without pausing the rest of the program (a timer needs to keep updating in real time). I can get the first menu option to go through, but it keeps assigning the enter key to the variable and I don't know how to stop it (it will also hold all data input before INKEY$ is used, ie if I press 0 five times before it can respond it will put all five 0s when it updates and reads INKEY$) here is the block

'TEXT$ GETS SET TO "" BEFORE THE LOOP THAT CALL IN
@KEYCHECK
IF !TCHST THEN RETURN
IF KEYBOARD=15 AND TEXT$="" THEN (SET MENU THINGS FOR DISPLAYING): VSYNC 2:RETURN 'entire thing is if backspace is pressed when no text 'is entered, vsync was there to try and stop the problem.
IF KEYBOARD=15 THEN TEXT$=LEFT$(TEXT$,LEN(TEXT$)-1):VSYNC 2:RETURN 'this allows them to actually backspace when they make a mistake.
IF KEYBOARD=60 THEN CHOICE$=TEXT$:TEXT$="":VSYNC 2:RETURN
IF (ENTER KEYBOARD LIMITS FOR NUMBERS AND LETTERS ACROSS MULTIPLE LINES) THEN TEXT$=TEXT$+INKEY$():VSYNC 2
(EXAMPLE OF ABOVE FOR NUMBERS: IF KEYBOARD >=2 AND KEYBOARD<=11 THEN...) 'I put these in to try and stop the enter key being added to the 'TEXT$ variable, but it did nothing
RETURN

the TEXT$ variable is printed elsewhere in the program within the loop, that works fine, CHOICE$ is used as the total input.
the problem is that because I check for what CHOICE$ is exactly, I can't get past the first menu, it would also be likely to cause problems when I want to set other variables to CHOICE$ at the end of the menu lines.

I'm not sure if i get your idea, but if i am right, al you need is place the "enter" check at the beggining of the code, i mean, what you have is "put anything that the player input" and at the end, if it is an "enter" then return, if you pur the "enter" at the beginning it will be: check if it "enter" key, if it is, return, if not, put anything that the player inputs.

btw, "enter" keyboard=60

Also you can use LEN to check if the word is long enought. Hope i helped you

Edited on by Javo118

3DS FC: 2921-9808-6856

tiger667

I have the enter check before it updates the TEXT$ but after it checks for backspace (added comment to block code to draw attention to this) , I just tried to move it above the backspace check, but it didn't help. The inkey$() seems to hold onto everything pressed and return them in order. example: i HAVE TRIED ADDING IF TCHTIME==1 to the ifs so it will only return one character even if the button is held, but when I hold on a key then move to another it keep returning the key that I held until it catches up to what I am actually pressing (returning multiple characters to TEXT$ each time) I think I am describing this horribly and I am sorry, I can't think of how to better explain right now.

EDIT: ok I made time for myself and solved the problem, it just adds a few more lines, I made another block
@CLEARINKEY
FOR I=1 TO 10
I$=INKEY$()
NEXT
RETURN

at the end of the menu it is not putting the name in the proper place, so I need to fix that. Thanks for trying to help me work through it, and I hope this can help someone else.

Edited on by tiger667

tiger667

lolkelvinlol

Morphtroid wrote:

If you heard a "Bing!" after putting it in the basket, then it means you did it right.
All you need to do is wait a day for your vegetables to be sold and you'll get the money.

Sorry I think I simply assumed everyone had played a Harvest Moon game before.

How much money do you get for each veggie?

my friend code:0817-5045-4594

Twitter:

lolkelvinlol

oh yeah the first time i played petit farm i got 8 turnips and i dropeed them all in the wrong place so i have only 400 money left -_-

my friend code:0817-5045-4594

Twitter:

Sprite

I found this guy on Gamefaqs

A game as big as the Legend of zelda handhelds?
No, I don't intend to make it myself, and YES I know it's difficult, and YES, I know it would have to be built from scratch, but I was wondering.

Would it be possible to make a game like Oracle of Season/Ages or link's awakening? After all, the DSi increases Basic's potential, doesn't it? And I'm sure you've some of the stuff that Petit can do.

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

KAHN

Sprite wrote:

I found this guy on Gamefaqs

A game as big as the Legend of zelda handhelds?
No, I don't intend to make it myself, and YES I know it's difficult, and YES, I know it would have to be built from scratch, but I was wondering.

Would it be possible to make a game like Oracle of Season/Ages or link's awakening? After all, the DSi increases Basic's potential, doesn't it? And I'm sure you've some of the stuff that Petit can do.

that's what i plan on doing. everything i've jotted down is original, not some port of another zelda game. i'm deep in, too. you can go ahead and tell this guy about what i've been saying in the thread if you want :3

KAHN

3DS Friend Code: 1032-1301-2772 | Nintendo Network ID: Milkman12

swordx

Sprite wrote:

I found this guy on Gamefaqs

A game as big as the Legend of zelda handhelds?
No, I don't intend to make it myself, and YES I know it's difficult, and YES, I know it would have to be built from scratch, but I was wondering.

Would it be possible to make a game like Oracle of Season/Ages or link's awakening? After all, the DSi increases Basic's potential, doesn't it? And I'm sure you've some of the stuff that Petit can do.

You could definitely do that. In fact, you could even port ALTTP to Petit Computer. However, it would require extensive programming knowledge, great artistic skills, a lot of time, and it would have to be spread over multiple programs.

swordx

KAHN

swordx wrote:

and it would have to be spread over multiple programs.

actually, i think there might be a way to solve (or at least make it easier to deal with) that problem. i'm working on a solution to that. i originally had that problem in mind, though.

KAHN

3DS Friend Code: 1032-1301-2772 | Nintendo Network ID: Milkman12

swordx

0LD_SK0OL_PUNK wrote:

swordx wrote:

and it would have to be spread over multiple programs.

actually, i think there might be a way to solve (or at least make it easier to deal with) that problem. i'm working on a solution to that. i originally had that problem in mind, though.

Yeah, I heard that some people came up with compressing the programs to erase most of this problem. I started programming in July, so I'm not even going to attempt this yet (although I do have ideas on how to do it).

swordx

KAHN

swordx wrote:

0LD_SK0OL_PUNK wrote:

swordx wrote:

and it would have to be spread over multiple programs.

actually, i think there might be a way to solve (or at least make it easier to deal with) that problem. i'm working on a solution to that. i originally had that problem in mind, though.

Yeah, I heard that some people came up with compressing the programs to erase most of this problem. I started programming in July, so I'm not even going to attempt this yet (although I do have ideas on how to do it).

yeah, that was the "solution" i spoke of, compressing all the programs into one. it's all possible because of the EXEC command.
10 EXEC"PRG:(program name here)"
and that kiddo is how it works. there are problems with this, though. you're right about the multiple programs, but the EXEC command makes it possible to combine all the programs into one, so it's more convenient for those who run your program. after the tests i performed, i think there might be some difficulty with the HP heart system in my zelda iii program.

KAHN

3DS Friend Code: 1032-1301-2772 | Nintendo Network ID: Milkman12

KAHN

here's how EXEC works:
10 EXEC"PRG:(program name here)"

When you use EXEC in the middle of a program, it warps you to the beginning of the program you listed, and you must already have this program on your Petit Computer program list. but if you want to go back to the original program, you'd think you just type in:
10 EXEC"PRG:(original program name here)"
right? well, that seems right to me. do that, and it will warp you to the beginning of the original program. but what i want to know is if it's possible to perform this whole procedure, only instead of back to the beginning of the original program, why not to where you left off in the original program (EX: if i put my EXEC command in the middle of the program, and i warp to another program, but i want to warp back to the original program, i should warp to the line right after the very first EXEC command)? someone in this thread tell me how i can do this.

KAHN

3DS Friend Code: 1032-1301-2772 | Nintendo Network ID: Milkman12

Discostew

You can use strings in GOTO statements to help you accomplish the task of jumping to another point in a program from the very beginning (after you use EXEC from another program). In one program, store a label in a string (like LBLJUMP$="@FUNC01"), use EXEC to go to another program, and then at the beginning of this other program, do a comparison on LBLJUMP$, so that if it isn't equal to an empty string, then just GOTO LBLJUMP$. In a case of being in program #1, then jumping to program #2, and then returning back to program #1 after that original EXEC, you'd need to do a few things.

First, the first line in program #1 should do a string comparison that will tell the program to jump to a certain label should the string holding the label name not be empty.

ex. IF RETLBL$!="" THEN GOTO RETLBL$

Second, place a label after every EXEC, and set the comparison string to that label name that is just after the EXEC command.

ex.
-PRG01-

..
..
RETLBL$="@MYFUNC"
EXEC PRG02
@MYFUNC
..
..

This way, you'll be set up to go back to program #1 with the right re-entry point after jumping to program #2. You'll have to make a label after each EXEC command, and store that label name in the same string for all jumps.

Discostew

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

KAHN

@Discostew
i got lost at the part with the comparisons and keeping the strings from being empty. elaboration, please?

KAHN

3DS Friend Code: 1032-1301-2772 | Nintendo Network ID: Milkman12

swordx

0LD_SK0OL_PUNK wrote:

here's how EXEC works:
10 EXEC"PRG:(program name here)"

When you use EXEC in the middle of a program, it warps you to the beginning of the program you listed, and you must already have this program on your Petit Computer program list. but if you want to go back to the original program, you'd think you just type in:
10 EXEC"PRG:(original program name here)"

right? well, that seems right to me. do that, and it will warp you to the beginning of the original program. but what i want to know is if it's possible to perform this whole procedure, only instead of back to the beginning of the original program, why not to where you left off in the original program (EX: if i put my EXEC command in the middle of the program, and i warp to another program, but i want to warp back to the original program, i should warp to the line right after the very first EXEC command)? someone in this thread tell me how i can do this.

I already knew about this, and it isn't compressing a program. IDK how to explain compressing programs. Oh, and to help you out, use variables to get you back to where you were. Have a variable for each line a program might be executed at, and have it go to an @label directly after that execution if the variable has the corresponding value.

EXAMPLE:

IF A==1 THEN @EXECUTIONA
IF A==2 THEN @EXECUTIONB
@START
....
....
...
@TOGRASSLANDS
EXEC(BLAH BLAH WHATEVS)
@EXECUTIONB

swordx

Discostew

0LD_SK0OL_PUNK wrote:

@Discostew
i got lost at the part with the comparisons and keeping the strings from being empty. elaboration, please?

I'll give a coded example, and you can see where I'm getting at (this is untested).

PRG01

IF RETLBL$!="" THEN GOTO RETLBL$
A=10
PRG02LBL$="@ADD2"
RETLBL$="@NEXTFUNC1"
EXEC "PRG02"
@NEXTFUNC1
PRG02LBL$="@MULT2"
RETLBL$="@NEXTFUNC2"
EXEC "PRG02"
@NEXTFUNC2
PRINT A
WAIT 120
END

PRG02

IF PRG02LBL$!="" THEN GOTO PRG02LBL$
' This program was ran outside of the original, so we will run that instead
EXEC "PRG01"
@MULT2
A=A*2
EXEC "PRG01"
@ADD2
A=A+2
EXEC "PRG01"


The end result, if either program is ran, should print 24 on the screen.

Edited on by Discostew

Discostew

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

KAHN

thanks a LOT! i really don't think i could have been taught better. i read it in the order that the computer would have read it, so that helped me understand the code. thanks. i'll try running this on PC later, then i'll try and apply it to something simple so i know i understand.

KAHN

3DS Friend Code: 1032-1301-2772 | Nintendo Network ID: Milkman12

Fadeintodust

So, I just have to ask. Oregon Trail, is that a project on anyone's list, has someone made it yet?

Fadeintodust

steriaca

Fadeintodust wrote:

So, I just have to ask. Oregon Trail, is that a project on anyone's list, has someone made it yet?

That is on my 'wish list' also. Hear is some more from it.
1) A platform game, a-kin to Donky Kong, but not using anything copyrighted.
2) An epic Dateing Game (we realy don't get them in North America), set in Victoriean Canada, where your a young Canadiean Mountie. Lots of mini-games to earn cash to spend on gifts. Once your near the enougth 'love points' with one girl to marry her, you have to save her from a evil villian and deathtrap before you can get down on one knee and ask the question.
3) A maze game a-kin to Pac-Man.
4) A horror based platform game a-kin to Castelvania.

My Friend Code is 3368-1310-0690.

bl0x0r3303

hi im new ive been playin petit computer for a while but i cant program can some one help me with this.
ps no tutorials help

Edited on by bl0x0r3303

bl0x0r3303

Please login or sign up to reply to this topic