Author Topic: How do you read and possibly write to an external program?  (Read 6024 times)

0 Members and 1 Guest are viewing this topic.

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
How do you read and possibly write to an external program?
« on: June 04, 2010, 06:13:26 pm »
The topic says it all.
I want to make a level editor for my bomberman program I'm making for the Axe Competition.
I want it so that a user writes a program named BOMBLVL(#/Letter) and the program can automatically detect which programs are there and read from them.  of course I'll probably add a random level generator and some included levels.

If it's not possible to detect many levels, at least one? ???
And then you could name it whatever you want, and you can still make many levels, just Rcl them into a program called BOMBRLVL or whatever I choose.

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: How do you read and possibly write to an external program?
« Reply #1 on: June 04, 2010, 07:30:52 pm »
as of now, you can only read programs, not create them. (Okay, not completely true, but the exception is you can overwrite an existing program with another one of the same name)
And for detection of levels, there is no nice way to scan the VAT yet, so you'll have to use GetCalc for each level name to see if it exists. (For this, you can just change the last letter of the name string, so you don't need lots of strings. Code below)
Code: [Select]
.Check for level, with X containing the final character, as stored by 'L'->X
"prgmBOMBLVL?"->Str1
.You can use whatever string, of course, and that question mark is just a dummy placeholder
X->{Str1+8
.The eight is because its the eight character in the string as indexed from zero, the "v" being the zeroth
GetCalc(Str1)->P
If
.Level Found!
Else
.Not found...
End
Something like this would probably be placed in a loop, with X being what is looped, and possibly with the X->{Str1+8 becoming {Str0+X}->{Str1+8 if X is an index to the list of searched characters.
Edit: replaced incorrect "v" with correct "prgm"
« Last Edit: June 04, 2010, 07:50:36 pm by calcdude84se »
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: How do you read and possibly write to an external program?
« Reply #2 on: June 04, 2010, 07:39:59 pm »
Hold up..  Have I missed something?!
Are you saying that "vSTRING->Str1:GetCalc(Str1->P also looks for Programs named "String"?, I thought it was just for AppVars?

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: How do you read and possibly write to an external program?
« Reply #3 on: June 04, 2010, 07:49:54 pm »
It does, though that should be "prgm", not "v", since "v" returns appvars in preference to programs, while "prgm" does the opposite. Let me correct that typo...
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: How do you read and possibly write to an external program?
« Reply #4 on: June 05, 2010, 07:45:05 pm »
OK...
I still don't understand how you would read FROM it though.  As in finding out whats written in it...

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline FinaleTI

  • Believe in the pony that believes in you!
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1830
  • Rating: +121/-2
  • Believe in the pony that believes in you!
    • View Profile
    • dmuckerman.tumblr.com
Re: How do you read and possibly write to an external program?
« Reply #5 on: June 05, 2010, 08:02:31 pm »
You could just read bytes from the pointer like, if your pointer is A, then you would just do {A}->{L1} which would store the value of the byte at A to the starting point of the L1 ram area for later reference.


Spoiler For Projects:

My projects haven't been worked on in a while, so they're all on hiatus for the time being. I do hope to eventually return to them in some form or another...

Spoiler For Pokemon TI:
Axe port of Pokemon Red/Blue to the 83+/84+ family. On hold.

Spoiler For Nostalgia:
My big personal project, an original RPG about dimensional travel and a few heroes tasked with saving the world.
Coding-wise, on hold, but I am re-working the story.

Spoiler For Finale's Super Insane Tunnel Pack of Doom:
I will be combining Blur and Collision Course into a single gamepack. On hold.

Spoiler For Nostalgia Origins: Sky's Story:
Prequel to Nostalgia. On hold, especially while the story is re-worked.

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: How do you read and possibly write to an external program?
« Reply #6 on: June 05, 2010, 08:17:29 pm »
I don't get it...
maybe I'm not stating my question clearly, I'm asking how to read from a user created program assuming you already know what that program is called.

@FinaleTI: But how would you know what byte the program is stored in?  Assuming you've understood my question properly.


EDIT:  Oh!  I just figured it out!
Just for confirmation though... Using Calcdude's method I would get the first byte which the program resides.  Then I could read from it with FInaleTI's.
But... How would I tell what was what?  Say I wrote prgmBOMBLVL# as :0123456789 and used the above method, would {L1} end up as 0 and {L1+1} end up as 1 and so on?
« Last Edit: June 05, 2010, 08:23:37 pm by yunhua98 »

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: How do you read and possibly write to an external program?
« Reply #7 on: June 05, 2010, 08:37:35 pm »
No, they'd end up as 48, 49, and so on (the hex, $30, $31, and so on looks much nicer, but anyway), because you're reading characters, not what they represent. Basically, what you see in the BASIC program editor is completely different than what the bytes are. (If you want to know the correspondences, here are token tables) Basically, if you want to use the BASIC editor as an editor, you'll have to implement a mini-parser, otherwise just ignore it.
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: How do you read and possibly write to an external program?
« Reply #8 on: June 07, 2010, 03:43:55 pm »
If It's just numbers, you could just read what character it is, and subtract 48.

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: How do you read and possibly write to an external program?
« Reply #9 on: June 08, 2010, 11:01:45 am »
True, but be aware that you'd be using one byte to store one base-10 digit. (only approx. 41.5% of a byte's capacity) Again, the level file format depends on how you plan to edit those files (Your own level editor vs. the TI-BASIC editor)
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.