Author Topic: GroupRead  (Read 1053 times)

0 Members and 1 Guest are viewing this topic.

Offline Xeda112358

  • Xombie. I am it.
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4374
  • Rating: +692/-6
  • meow :3
    • View Profile
« on: December 21, 2012, 10:17:03 am »
About 4 days ago, I started working on this project. Unfortunately, I am not home yet, so I cannot upload it, but I'll edit this post on the 30th (hopefully). Anyways, I decided to make a program like CopyProg, except it works with groups. Naturally, some features were excluded (you cannot delete lines from grouped program, for example), but I think this is a pretty neat program, so far. Here are its features:
  • One command lets you read the names and variable types of each variable in the group. It also returns the size of the data in theta (this is similar to the GetName command in CopyProg). If you try to read the zeroth var name, it will instead return how many variables are in the group.
  • Another command will let you extract a variable (by name) and copy it to another variable in RAM (this is like the CopyProg command)
  • Another command will let you read a line from a variable (like ReadLine)
  • Another command will let you recall a picture from the group, using one of these methods: Overwrite, AND logic, OR logic, XOR logic.

As you might imagine, this program can be useful for RPGs, and this is what I am keeping in my thoughts as I plan more routines. As it is, I think it is basically finished (for a version 1). I now need to clean up my code a bit to remove unused stuff. Also, it is a little over 800 bytes at the moment, so hopefully I can optimise it down a bit :/ The largest pieces of code come purely from reading the group data.

Here is an outdated screenie:

As an example, if you want to copy prgmFOO from the group named BACKUP to the protected program named BAR:
Code: [Select]
I plan to modify this command to use Ans instead of Str1, by the way. And to recall Pic3 using XOR logic to the graph screen from the same group:
Code: [Select]
"RecallPic  xor BACKUP→Str1
2     ;2 corresponds to Pic3, 0 corresponds to Pic1
I hope I get home on time (9 days from now) so I can upload the program :P
EDIT: I have now uploaded the program and documentation! Here is the readme:
Quote from: Readme

GRPREAD    985 bytes
by Zeda Elnara
  GrpRead is a program for BASIC programmers that want to work
with groups in some pretty cool ways. For example, say you have
an RPG that uses all 10 picture variables and it uses tons of
memory just for item names or monster names, or something like
that. If you group them (using the OS menu), GrpRead will let
you recall those pictures directly from the group and read lines
of code from programs in the group. These are just a few
examples of what GrpRead can do, so read on and I hope this
proves useful!
  Send GRPREAD.8xp to your calculator. You can now use it.
How to Use/
  Arguments are passed mostly through strings or numbers. It
will then return data or perform some function.
     |GetName                                                  |
     |  The group variable will have variables in it. If you   |
     |want to figure out the names of the variables, their type|
     |and their size, this is the command to use. This returns |
     |info on the 'nth' variable in the group. It can also be  |
     |used to figure out how many variables are in the group.  |
        Str1 has the name of the group
        Ans is the nth var name to return, or zero
        Ans has the name of the variable (with a prefix byte)*
        Theta has the size of the variable's data
       *A prefix byte is used to specify the type of the
        variable. This is either the " and " token or a letter.
        See the text document named "Prefix Bytes.txt" for info.
        If the input Ans was 0, this instead returns the number
        of variables in the group. If the group doesn't exist,
        0 is returned.
        "." is returned if the nth variable doesn't exist
        Check if group BACKUP exists and how many vars it has:
        Get the name/size/type of the first variable:
     |ExtractVar                                               |
     |  This command allows you to extract a variable from the |
     |group, copying it to some variable in RAM. This also     |
     |allows you to rename the variable and it automatically   |
     |overwrites a preexisting variable (unless you specify not|
     |to overwrite). There are some pretty neat things you can |
     |do with this, especially for games.                      |
       Ans is a string containing the name of the group, the
       name of the variable to extract, and possibly the new
       name to extract to. The format:
       The last argument is optional. If you put a "+" before
       the new name, the var will not be ungrouped if it already
       The variable is copied from the group to a var in RAM.
       0 is returned if the group does not exist.
       First, note that the prefix byte for a program is E and
       the prefix for an appvar is U. Now, to extract prgmFOO
       from group BACKUP:
       Now to extract prgmFOO to appvar BAR:
       Now to extract it to appvar BAR without overwriting:
       To extract prgmFOO without overwriting it if it exists:
       As you can see, you are able to extract to completely
     different variable types. Use this to your advantage, but
     since lists, real numbers, and matrices have a different
     structure from the other variable types, you should not try
     to extract them or extract to them (or you will lose RAM).
     |RecallPic                                                |
     |  This will let you recall pictures directly from the    |
     |group. Not only that, but it gives you four different    |
     |methods of recalling the picture instead of the 1 way    |
     |that the OS provides.                                    |
     Input (syntax 1):
       Ans is a string with the format
         "RecallPic <Pic#><logic><groupname>"
     Input (syntax 2):
       Ans is the picture number (0=Pic1, 1=Pic2,...,9=Pic0)
       Str1 has the format:
         "RecallPic <logic><groupname>"
       (This is useful for maps and monsters and hacked pics)
       The picture var is drawn and the screen is updated if the
       picture variable exists.
       The logic tokens are as follows:
            or    (This is what the OS uses).
       They can be found at [2nd][Math][Right]. If this argument
       is omitted, the picture will simply overwrite the data on
       the screen.
       Recall Pic1 from group BACKUP, overwriting the data on
     the screen:
            :"RecallPic Pic1BACKUP
       Recall Pic3 from group RPG using XOR logic (syntax 2):
            :"RecallPic  xor RPG->Str1
     |LineRead                                                 |
     |  This lets you read a line of code from a program in a  |
     |group. Note that the line doesn't actually need to be    |
     |code. You can store a bunch of names or words line by    |
     |line in a program. Then, using this function, you can    |
     |recall the data as a string in Ans. Enjoy!               |
       Str1 is of the form "Line(<groupname>,<varname>"
       Ans is the line number to read (or zero)
       Ans is a string containing the name contents of the line.
       If Input Ans was zero, this instead returns the number of
         lines in the variable.
       ".NO DATA" is returned if the line is empty.
       Read the fourth line of prgmRPGDATA from the group RPG:
  When I wrote this program, I was away from my computer,
internet (or electricity, for that matter) for several weeks. I
wrote the program using a combination of hex and a program named
ASMCOMP. It was basically like writing the program in hex the
normal way, but with the advantage of having labels and equates
and whatnot. Therefore, the source is in the form of a program
to be compiled by prgmASMCOMP.
7:37 PM 12/30/2012- Wrote the readme and prepared for initial
release. GetName,ExtractVar,RecallPic,LineRead.        985 bytes

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3724
  • Rating: +276/-12
  • Survivor of Apocalypse
    • View Profile
Re: GroupRead
« Reply #1 on: December 21, 2012, 02:00:50 pm »
Finally a program that I've been wanting for so long O.O
Can't wait for it!
Sig wipe!

Offline xlibman

  • Now active at
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55807
  • Rating: +3148/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • CodeWalrus
Re: GroupRead
« Reply #2 on: December 22, 2012, 02:43:08 am »
Interesting, so basically it lets you ungroup stuff within BASIC programs so RPGs, for example, can be kept in as few files as possible?

One thing, though, if you have the ability to group files or add them to groups, make sure to check for archived stuff, because I once tried to group an archived program on an old OS (way back in Feb 2002) that sometimes displayed archived programs in the group menu when archive was on the verge of garbage collection, and the result was not pretty... O.O (thankfully I had the receipt so I got a new calc in exchange)
« Last Edit: December 22, 2012, 02:43:33 am by DJ_O »
In case you are wondering where I went, I am still active in the TI community, but I left Omni back in 2015 for various  reasons. I might come back one day, depending of certain circumstances, but my new online home (despite me being Omnimaga founder in 2001) is now CodeWalrus ( ). Sorry for the inconveniences.

Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline Xeda112358

  • Xombie. I am it.
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4374
  • Rating: +692/-6
  • meow :3
    • View Profile
Re: GroupRead
« Reply #3 on: December 30, 2012, 08:12:41 pm »
Interesting, so basically it lets you ungroup stuff within BASIC programs so RPGs, for example, can be kept in as few files as possible?
Yes, precisely! I was also thinking of having a function to execute programs from a group. That would save you from having to manually copy it to RAM and execute it.
I also won't be adding the ability to group files, so I won't have to worry about causing that kind of a problem XD

Finally, I attached the download to the first post, as well as the readme/documentation so you can read about it :D