* WalrusIRC

You need to have 5 posts and not be part of restricted usergroups in order to use the WalrusIRC embedded shoutbox. However, you can also access our IRC channel called #CodeWalrus via EFnet.

Author Topic: TI-Basic DIY Library  (Read 1726 times)

0 Members and 1 Guest are viewing this topic.

Offline p2

  • CodeWalrus Staff
  • Super User
  • Moderator
  • CodeWalrus Supporter
  • *
  • Join Date: Aug 2016
  • Location: Germany
  • Posts: 2266
  • Post Rating Ratio: +8/-0
  • *Wubba lubba dub dub*
    • KaliPhobos
  • Gender: Male
Re: TI-Basic DIY Library
« Reply #15 on: January 16, 2017, 02:26:48 pm »
if you have the appvar OIRAM and the appvar NOMEKOP and both have the command DRAWSTUFF(
how does the game decide which one to use? :)
  • Calculators owned: ti-83+, ti-84+, ti-84+, ti-84+se, ti-84+se(te), ti-nsphire, 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)

Offline 123outerme

  • Super User
  • Join Date: Jan 2015
  • Location: In spaaace! Well, the Earth is anyhow.
  • Posts: 624
  • Post Rating Ratio: +5/-0
  • Professional Unpaid Intern
    • 113/11355
  • Gender: Male
Re: TI-Basic DIY Library
« Reply #16 on: January 16, 2017, 02:43:28 pm »
if you have the appvar OIRAM and the appvar NOMEKOP and both have the command DRAWSTUFF(
how does the game decide which one to use? :)
In your program, you will define which AppVar to use. You can technically use both, but there's no point since you can add as many subroutines as you want.
This is about how it is done:
Code: [Select]
:"OIRAM->Str0    // If you want the other AppVar, just change it to "NOMEKOP->Str0
:"DRAWSTUFF(20
:prgmDIYILB
What prgmDIYLIB does exactly, is it reads the string of commands in your DIYLIB, then it decides which one you've inputted (no matter the command string length) and executes the code stored under line [command number] +1, where [command number] is the order in which your CALL( appears. Another example, this time of the AppVar:
Code: [Select]
1 :DIGIT(CALL(EXECUTE(A(
2 :code for DIGIT(
3 :code for CALL(
4 :code for EXECUTE(
etc.
So for CALL(, it looks in the string for CALL(. It's the second command in the list, so it adds 2 (the listing) + 1 (offset since call names are stored in line 1)
Also, if you downloaded the original, please redownload. I made an error, so it could only handle 2 functions. Now it can handle as many as possible.
« Last Edit: January 16, 2017, 04:21:01 pm by 123outerme »
  • Calculators owned: TI-84+CSE, TI-nspire Clickpad, TI-84+SE

Offline p2

  • CodeWalrus Staff
  • Super User
  • Moderator
  • CodeWalrus Supporter
  • *
  • Join Date: Aug 2016
  • Location: Germany
  • Posts: 2266
  • Post Rating Ratio: +8/-0
  • *Wubba lubba dub dub*
    • KaliPhobos
  • Gender: Male
Re: TI-Basic DIY Library
« Reply #17 on: January 16, 2017, 03:03:30 pm »
really nice, might be a great help for on-calc programmers (dont have to type the same super song formula a thousand times again) xD
how big exactly is the slowdown? :)
could you do two counters, one using the external command thingy, one directly counting, and tell us the results (speed comparison)? :)
I'm really interested in how fast it is ^^
  • Calculators owned: ti-83+, ti-84+, ti-84+, ti-84+se, ti-84+se(te), ti-nsphire, 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)

Offline 123outerme

  • Super User
  • Join Date: Jan 2015
  • Location: In spaaace! Well, the Earth is anyhow.
  • Posts: 624
  • Post Rating Ratio: +5/-0
  • Professional Unpaid Intern
    • 113/11355
  • Gender: Male
Re: TI-Basic DIY Library
« Reply #18 on: January 16, 2017, 03:04:43 pm »
really nice, might be a great help for on-calc programmers (dont have to type the same super song formula a thousand times again) xD
how big exactly is the slowdown? :)
could you do two counters, one using the external command thingy, one directly counting, and tell us the results (speed comparison)? :)
I'm really interested in how fast it is ^^
Yeah, I was actually planning on doing that now. I'll edit with the results.
Edit:
Running this set of code to determine speed. Here you can see how many times the loop repeats and the command/equates I used.
Code: [Select]
"rowSwap(LIBNEW00→Str0
startTmr→T
For(F,1,150
"DIGIT(F
prgmDIYLIB
End
checkTmr(T-I
Ans/150→G
startTmr→T
For(F,1,150
int(1+log(real(F+(0=real(F
End
checkTmr(T)→J
Ans150→H
Disp G,H," ",I,J
Pause
Now here's the results.
[loops] = 150: DIYLIB took an average of .16 seconds to process each request, and the straight command took .013333.... seconds.
DIYLIB, in 150 loops, took ~24 seconds, while the straight command only took ~2.
« Last Edit: January 16, 2017, 03:24:47 pm by 123outerme »
  • Calculators owned: TI-84+CSE, TI-nspire Clickpad, TI-84+SE

Offline p2

  • CodeWalrus Staff
  • Super User
  • Moderator
  • CodeWalrus Supporter
  • *
  • Join Date: Aug 2016
  • Location: Germany
  • Posts: 2266
  • Post Rating Ratio: +8/-0
  • *Wubba lubba dub dub*
    • KaliPhobos
  • Gender: Male
Re: TI-Basic DIY Library
« Reply #19 on: January 16, 2017, 03:25:21 pm »
ouch those numbers hurt...  :ninja:
can you maybe determine where the slowdown comes from?
try a loop INSIDE the external thingy (the userdefined command).
maybe it just takes time to lookup what should be executed, while the execution itself is at regular speed again, which means the slowduwn would be much smaller for real day-to-day usage.
  • Calculators owned: ti-83+, ti-84+, ti-84+, ti-84+se, ti-84+se(te), ti-nsphire, 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)

Offline 123outerme

  • Super User
  • Join Date: Jan 2015
  • Location: In spaaace! Well, the Earth is anyhow.
  • Posts: 624
  • Post Rating Ratio: +5/-0
  • Professional Unpaid Intern
    • 113/11355
  • Gender: Male
Re: TI-Basic DIY Library
« Reply #20 on: January 16, 2017, 03:27:49 pm »
ouch those numbers hurt...  :ninja:
can you maybe determine where the slowdown comes from?
try a loop INSIDE the external thingy (the userdefined command).
maybe it just takes time to lookup what should be executed, while the execution itself is at regular speed again, which means the slowduwn would be much smaller for real day-to-day usage.
I'm almost positive the issue is finding the command to be used. It basically runs a whole While loop to find the command. That, jumping between programs, and the simple fact that any code that does more than just the equation will inevitably be slower; I'm running all this code to find the equation, then the equation itself.
  • Calculators owned: TI-84+CSE, TI-nspire Clickpad, TI-84+SE

Offline kotu

  • Microsoft Edge V
  • Super User
  • Join Date: Aug 2016
  • Location: UK<---.edge
  • Posts: 1123
  • Post Rating Ratio: +7/-10
  • Edge User
    • dj_kotu
    • @UCAy2ZF4hbc08iStnTn6jgxQ
    • rowanmedhurst
    • @romanov-psyco
    • futurerave.uk
  • Gender: Male
Re: TI-Basic DIY Library
« Reply #21 on: January 16, 2017, 03:29:00 pm »
shouldn't you store each command's lookup address before you start? idk never programmed a emulator or anything like that b4
  • Calculators owned: TI 84+CE-T
  • Consoles, mobile devices and vintage computers owned: Sega Master System, Sony PlayStation 3

http://futurerave.uk/admin
my blog is proper insecty, V

Offline 123outerme

  • Super User
  • Join Date: Jan 2015
  • Location: In spaaace! Well, the Earth is anyhow.
  • Posts: 624
  • Post Rating Ratio: +5/-0
  • Professional Unpaid Intern
    • 113/11355
  • Gender: Male
Re: TI-Basic DIY Library
« Reply #22 on: January 16, 2017, 03:30:56 pm »
shouldn't you store each command's lookup address before you start? idk never programmed a emulator or anything like that b4
Because each command can be a variable number of letters, I have to find where each opening parentheses are. There's no way to do this other than a loop. It basically checks the if the command you're attempting to call is anywhere in the system, and what expression/algorithm it goes to.
  • Calculators owned: TI-84+CSE, TI-nspire Clickpad, TI-84+SE

Online xlibman

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18609
  • Post Rating Ratio: +95/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • DJ Omnimaga music store
  • Gender: Male
Re: TI-Basic DIY Library
« Reply #23 on: February 05, 2017, 04:39:53 pm »
I'm kinda curious if some sort of game can be made out of this, such as a turn based text based fighting game
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline 123outerme

  • Super User
  • Join Date: Jan 2015
  • Location: In spaaace! Well, the Earth is anyhow.
  • Posts: 624
  • Post Rating Ratio: +5/-0
  • Professional Unpaid Intern
    • 113/11355
  • Gender: Male
Re: TI-Basic DIY Library
« Reply #24 on: February 05, 2017, 09:20:32 pm »
I'm kinda curious if some sort of game can be made out of this, such as a turn based text based fighting game
It's possible. I think I want to update this though, so I can improve speed. This is the pseudo-code for what this already does:
Code: [Select]
Get the input string
Read the DIYLIB appvar to determine which command is being called; repeats through the "master string" holding every command name
Execute the code on one on the corresponding line
and this is the pseudo-code for what I'd want it to do, should I update it:
Code: [Select]
Get the input string
Read every other line of the appvar until you find the command being called
Execute the code, which appears on the next line
I don't have an exact estimate for the speed increase, it really depends on how many commands it'd have to read before finding the one you want. On the other hand, the current version has a constant speed (12x slower than just writing out the command). The DIY Library is, in my eyes, more suitable for saving bytes than anything. I would recommend it just to use it for setting up variables at the beginning of a program that require a really large algorithm to be executed. I'm guessing the fastest the second method I shared would be at its fastest, probably 4x slower than just writing out the command. At its slowest, it's probably unusable (again, if it has to search through a lot of commands to find what you want).
  • Calculators owned: TI-84+CSE, TI-nspire Clickpad, TI-84+SE

Online xlibman

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18609
  • Post Rating Ratio: +95/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • DJ Omnimaga music store
  • Gender: Male
Re: TI-Basic DIY Library
« Reply #25 on: March 11, 2017, 07:56:56 am »
Ah ok. I guess it can still be handy if the program size + this lib size is worth it or if it makes development much more simple without making the program unuseable speed-wise. In any case, good luck if you ever update this.
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

 


You can also use the following HTML or bulletin board code to share it on your page or forum signature!


Also do not forget to check our affiliates below.
Planet Casio TI-Planet Calc.news BroniesQC BosaikNet Velocity Games