Author Topic: GetName: Another great BASIC tool  (Read 2480 times)

0 Members and 1 Guest are viewing this topic.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
GetName: Another great BASIC tool
« on: February 05, 2011, 06:28:13 pm »
GetName is a program inspired by a request from mrmprog over on UTI. This also happens to be the same person who inspired the idea of CopyProg. So what does this program do? Well, it is really simple, actually. It returns the name of a program. Let me elaborate a little more. Say I wanted the name of the first program in the program menu. I would do:
Code: [Select]
:0
:Asm(prgmGETNAME
If I wanted the name of the second program, I would use 1 instead of 0. Also, instead of just returning "RAH" it will return the name of the program with a prefix byte. So if it is a normal program, the string starts with "E" followed by the name. If it is a protected program, it starts with "F" and if you are familiar with CopyProg, you will start to see the usefulness of this.

If the program does not exist, "." is returned. This program makes it easy to show a list of all the programs on the calc. It also makes it easy to play with that list, especially if you happen to have prgmCOPYPROG. You can make a BASIC shell with these two programs. If you want to play prgmRANDOM and it happens to be in the archive, that is no problem!
Code: [Select]
:B                  ;the number for program to copy to RAM and execute
:Asm(prgmGETNAME
:Ans→Str1
:"[TEMP             ;This tells CopyProg to create and copy to prgmTEMP
:Asm(prgmCOPYPROG
:prgmTEMP           ;Executes the program
:"-[TEMP            ;This tells CopyProg to delete prgmTEMP
:Asm(prgmCOPYPROG

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: GetName: Another great BASIC tool
« Reply #1 on: February 06, 2011, 01:14:51 am »
Interesting. Is there a way to also detect what kind of program they are? I am curious how this could be used in a game?
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: GetName: Another great BASIC tool
« Reply #2 on: February 06, 2011, 01:40:18 am »
Well it does return an "E" as the leading byte for a regular program and an "F" for a protected program. However, since that post I have made an updated version.
...
And with that update I made an example program...
The example uses CopyProg and GetName to handle variables. In this updated version, if you change the input to a list, you can change which variable type to search for. Anyway, here is the example and update.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: GetName: Another great BASIC tool
« Reply #3 on: February 06, 2011, 02:46:09 am »
Ah ok. I'Ll probably need to check your code to understand more. X.x
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: GetName: Another great BASIC tool
« Reply #4 on: February 06, 2011, 02:55:27 am »
Ah, it might help to see the request:
Quote
mrmprog: Does anyone have a hexcode that can be entered on-calc that would detect the programs on the calculator?
Me: How do you mean? Like do you mean return a list of all the programs on the calc?
mrmprog: Exactly. The thing is, a string would have to have some type of separator so you would know when one starts and one ends.
I just changed it so instead of returning a string of names, 0 grabbed the first name, 1 got the second, et cetera.

Sorry, my brain is kind of dead so I cannot explain well :F

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: GetName: Another great BASIC tool
« Reply #5 on: February 06, 2011, 03:19:02 am »
Mhmm I see. Lol I thought you meant Andrepd since I misread mrmprog as MMORPG (such as Walkdontescape, World of Warcrack, etc :P). X.x
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: GetName: Another great BASIC tool
« Reply #6 on: February 06, 2011, 10:50:47 am »
Ah, okay! Yeah, pretty much if I do 0:Asm(prgmGETNAME it returns the name of the first program. If I use a list instead I can choose the type :D

So pretty much, used with CopyProg you can do some really cool things! I want to add the ability to return some stats about the var (size, archived/unarchived) because then it can pretty much be a BASIC version of MirageOS for nostub programs ^-^

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: GetName: Another great BASIC tool
« Reply #7 on: February 07, 2011, 11:41:19 pm »
Now for a library that compresses Illusiat 13 from 135 KB to 10 KB. :P
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: GetName: Another great BASIC tool
« Reply #8 on: February 08, 2011, 01:15:18 am »
>_>
<_<
Maybe if I looked at the source... Is it mostly data?

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: GetName: Another great BASIC tool
« Reply #9 on: February 08, 2011, 01:24:57 am »
I was kidding. Most data is text, lol. :P

This video can give you an idea of how developed were the game events sometimes, in terms of NPC convos. :P

http://i-lost-the-ga.me/Illusiat13The_9_Disciples_And_The_Emperor.wmv (WARNING: SPOILERS!)
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: GetName: Another great BASIC tool
« Reply #10 on: February 08, 2011, 01:32:14 am »
Well I did make a text compressor and decompressor that could compress up to 50% (though normally around 60% to 70%). Unfotunately, it used BASIC and Celtic 3 and was horribly slow with large text files. However, I do want to make an assembly version...

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: GetName: Another great BASIC tool
« Reply #11 on: February 08, 2011, 01:34:49 am »
An ASM version would be nice. Even in ASM some coders had to limit their game plot because they had no compression for text. You would have to make sure the text is easy to compress/decompress for editing, though, in case, for example, someone wants to translate the game.
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: GetName: Another great BASIC tool
« Reply #12 on: February 08, 2011, 02:08:30 am »
Yeah... The method I used needed a key, but so long as you had the key you simply put the string to compress or decompress in Ans and it would output the compressed/decompressed form. The problem is that you have a limited number of chars to use. The compressed size would be anywhere from 50% to 100%, but for a 31 char set, the compression is typically down around 60% to 70%.

Here is a screeny I just put together. Also, that video was amazing DJ! You are definitely the king of RPGs without a doubt!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: GetName: Another great BASIC tool
« Reply #13 on: February 08, 2011, 02:14:57 am »
Hmm I see. In my case it would be more convenient if it allowed compressing large strings in batches, especially with 40+ KB of text. :P

And lol thanks, I wish I had motivation to work on a RPG again and finish Illusiat 13. D:
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)