Join us on Discord!
You can help CodeWalrus stay online by donating here.

My BASIC Questions

Started by xMarminq_, November 13, 2016, 11:24:38 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

xMarminq_

I am making a part of a game where I need two things running at once, like doing an action in a said time period.
Let me know what you would do, and will certainly help in the development. 
  • Calculators owned: Ti-84 Plus CE, Ti-84 Plus (can be borrowed from my school)
I don't associate with associations

E37

I would have them take turns running. Knowing what two things would be helpful.
To answer your question, there is no way of doing two things at the exact same time at all on the calc.
  • Consoles, mobile devices and vintage computers owned: Ti83,Ti84!
I've never finished a project, there is always a way to improve!
What's my calc's name? Convert $37 to decimal. Look up that element in the periodic table. Then take the abbreviation of that element and you have it!
Look! A slime!    <(^.^)>

p2

in general you can either switch between two tasks super fast or do two things after another and repeat that over and over again...
which would be Interrupts (not available in pure BASIC) or putting everything in your main loop ^^
While 1
: task 1
: task 2
: task 3
:End

btw WHILE 1 is the same as WHILE TRUE which means the condition (true) is always met ---> infinite loop :)

But before trying something fancy now, listen to E37 as there are better ways of doing many things ^^
  • Calculators owned: ti-83+, ti-84+, ti-84+, ti-84+se, ti-84+se(te), ti-nsphire, ti-nsphire CAS, ti-nsphire CX-CAS, ti-voyage, ti-voyage, Who reads this list anyways...?
Anyway war sucks. Just bring us your food instead of missiles  :P ~ DJ Omnimaga (11.10.2016 20:21:48)
if you cant get a jframe set up, draw stuff to it, and receive input, i can only imagine how horrible your game code is _._   ~ c4ooo (14.11.2016 22:44:07)
If they pull a Harambe on me tell my family I love them ~ u/Pwntear37d (AssangeWatch /r/)
make Walrii great again ~ DJ Omnimaga (28.11.2016 23:01:31)
God invented the pc, satan the smartphone I guess ~ p4nix (16.02.2017 22:51:49)

kotu

We really need a bit more information as.... you may have a simpler situation than described above

For example if you need to work out distance travelled for two cars, you can just multiply 'Time Passed' by Speed and there you have both distances
  • Calculators owned: TI 84+CE-T
  • Consoles, mobile devices and vintage computers owned: Sega Master System, Sony PlayStation 3
SUBSCRIBE TO THE FUTURERAVE.UK MAILING LIST
http://futurerave.uk

xMarminq_

Like I want someone to tap a button to get to a certain value while a timer is going off
  • Calculators owned: Ti-84 Plus CE, Ti-84 Plus (can be borrowed from my school)
I don't associate with associations

kotu

What you want to do is fairly simple - someone else will explain though as I don't know really any TI-BASIC
  • Calculators owned: TI 84+CE-T
  • Consoles, mobile devices and vintage computers owned: Sega Master System, Sony PlayStation 3
SUBSCRIBE TO THE FUTURERAVE.UK MAILING LIST
http://futurerave.uk

xMarminq_

Start mentioning people you may know who could help
  • Calculators owned: Ti-84 Plus CE, Ti-84 Plus (can be borrowed from my school)
I don't associate with associations

kotu

I don't know who uses TI-BASIC on here, I'm more into other languages, namely C and C++

What you want though is an infinite loop, in which you keep checking for key presses, and keep checking the timer  :P
  • Calculators owned: TI 84+CE-T
  • Consoles, mobile devices and vintage computers owned: Sega Master System, Sony PlayStation 3
SUBSCRIBE TO THE FUTURERAVE.UK MAILING LIST
http://futurerave.uk

xMarminq_

Any way someone can create something like that here?
  • Calculators owned: Ti-84 Plus CE, Ti-84 Plus (can be borrowed from my school)
I don't associate with associations

kotu

Someone else can help you, not me.
  • Calculators owned: TI 84+CE-T
  • Consoles, mobile devices and vintage computers owned: Sega Master System, Sony PlayStation 3
SUBSCRIBE TO THE FUTURERAVE.UK MAILING LIST
http://futurerave.uk

kotu

#10
Can someone help _xmarminq with some getkey() function equivalent and some timer function for TI-BASIC. Thanks  (-_(//));

*Edit*
@xMarminq_ check out these 2 webpages...

http://tibasicdev.wikidot.com/getkey

http://tibasicdev.wikidot.com/timers

ps. sorry for top-posting  :'(
  • Calculators owned: TI 84+CE-T
  • Consoles, mobile devices and vintage computers owned: Sega Master System, Sony PlayStation 3
SUBSCRIBE TO THE FUTURERAVE.UK MAILING LIST
http://futurerave.uk

JWinslow23

@xMarminq_ , I could help. I'm not sure you're being specific enough, but it sounds like a Cookie Clicker-type thing.

You will have to be more specific, though. What project are you working on? Can you describe what it's supposed to look like? Do you have a TI-83+, TI-84+, or the TI-84+ color models? (as far as timers, there are differences between different models)

xMarminq_

It is a CE, (5.2 OS) and I want something around a game where you press a button as much as you can to get to certain value in an amount of time (maybe when a key pressed add symbol +, when time expires delete last +, constant decrease of +1 every second) and the If A=7 (Goal) , do this, If A≥7, Menu for restart, if A≤7, action as if goal. (IS this possible? let me know.
  • Calculators owned: Ti-84 Plus CE, Ti-84 Plus (can be borrowed from my school)
I don't associate with associations

JWinslow23

Quote from: xMarminq_ on November 14, 2016, 09:21:42 PM
It is a CE, (5.2 OS) and I want something around a game where you press a button as much as you can to get to certain value in an amount of time (maybe when a key pressed add symbol +, when time expires delete last +, constant decrease of +1 every second) and the If A=7 (Goal) , do this, If A≥7, Menu for restart, if A≤7, action as if goal. (IS this possible? let me know.

Quote from: xMarminq_ on November 14, 2016, 09:21:42 PM
(IS this possible? let me know.
TI-BASIC is Turing-complete; basically, anything's possible ;) .

So, what you might be looking for here is a Repeat loop and getKey. Repeat has this syntax:
Repeat <conditional>
<code>
End

Where <conditional> is the conditional that will end the loop when it is true, and <code> is the code to repeat.
Repeat always runs unconditionally once, then at the end of the loop, it checks the conditional, and exits if it's true, and otherwise it restarts.

getKey is a number that depends on the row and column of the current key pressed (for example, Y= is 11 because it's in row 1 column 1, PRGM is 43 because it's in row 4 column 3, etc). There are only two "exceptions"; row 2 is considered to have 2ND, MODE, DEL, LEFT, UP, and RIGHT, and row 3 is considered to have ALPHA, XTON, STAT, and DOWN.

I obviously cannot write the code for you (you know your game idea better than me), but here's a rough guideline:
Repeat A>=7         // I assume that's what you want to end on. You never told me what it meant, though.
  getKey->K
  If K=<keycode>    // put keycode here
  Then
    <action for a keypress>
  End
  <other actions>
End


Still not sure exactly what you mean by your idea, but hopefully I helped!

Oh, and timer commands will be useful too, but I don't wanna teach you about them unless I know it's precisely what you need.

xMarminq_

I want dat :D (Timer)
ill try it when I get to that part of my project I'm making
  • Calculators owned: Ti-84 Plus CE, Ti-84 Plus (can be borrowed from my school)
I don't associate with associations

Powered by EzPortal