Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
Adamac:
The string listed above is 16X's first line. (1X 14 spaces 1X.) repeat this 6 times. the 16X's. should end up to 128 characters.
Good call, ZeldaKing. I really hope he perseveres with trying graphical homescreen games so he can expand his coding horizons a bit. Unless most of the fun of it for him is writing the plotlines for a text game.
Ok that's it; I've gotta add something sufficient here.

1) Kerm is right about using strings for the map because (1) the memory size (never thought about that; I always think about program size, and then consider anything else to be shared RAM anyway) and because the substring command DOES make it quick to output (else a coordinate-per-item trick would be faster than 128 specific outputs).

2) Let me fix up that display code for you. This will work as long as Str0 has 128 characters:


Code:
...
:For(Y,1,8
:Output(Y,1,sub(Str0,16Y-15,16
:End
...


I recommend storing different levels in different strings, but then storing the current level (string) into Str0 so that you can use the same code in a loop for each level. Alternately, you can store multiple levels in one big string that is (number of levels)*128 characters long, and each time grab the substring of it for the right level sub(strX,128*level,128)->Str0.

As for the key input, here is an awesome technique that will shorten the code for movement with arrow keys and also check if it can move there on the map (assuming that X and Y are the position of the thing to move, and that Str0 is your map-string):


Code:
:GetKey->K
:X+(K=26 and X<16)-(K=24 and X>1->A
:Y+(K=34 and Y<8)-(K=25 and Y>1->B
:If(" "=sub(Str0,X+16Y-15,1
:Then:A->X:B->Y:End
Or if that confuses you just stick to what you know, and learn while making it and you can go back and change those if you want.
Well, he's been making these text-based games for years, and while I'm sure they're fun, I think it's time for him to expand his knowledge rather than just sticking to what he knows. Smile
Thanks, Kerm.

And while, yes, the key-input is a bit advanced, the display thing is actually much simpler than (and actually functional versus) most of the other examples of such given in this thread. One of the main points is that you have to take into account that the row & column count starting at 1 means that going {column+16*row} automatically puts position (1,1) at 17 in the string (rather than 1), so you'd have to subtract enough (16) so that position(1,1) gives you 1.

Perhaps I should explain the key-input code more rather than just dumping it here. First off, a statement such as {theKeyPress = someKey} is going to resolve to 1 (true) or 0 (false). Anding it with "is it in bounds?" causes it to be ignored if it is not in bounds. Roughly, the "(K=26 and X<16)" part is saying "did you press [right] AND can you move that way without going off the screen (i.e. the column is less than the max)?" If and only if both of those are true, you get 1; else you get 0. I did a similar thing with "(K=24 and X>1)" to get 1 if you pressed [left] and it's not already too far over to move left; only I SUBTRACTED it. Basically, the whole expression "X+1(K=26 and X<16)-1(K=24 and X>1)" says add to the column (1 if we are moving right, -1 if we are moving left); except you don't need the 1's in there.

Anyway, the change in column is stored in A, and the change in row is stored in B (rather than storing them back into X and Y) so that the statement below those can check to see if that spot on the map is even something you can move onto (hence, "IF" (that position in the string) is a " "; unless there are other things you can move onto), and "IF" it is allowed to move there, THEN it stores the new position to X and Y. You can do both at the same time because you can only have one key value given from GetKey anyway; so if anything is different, it will be either the row or column, but not both. If NO movement is made, then you are adding 0 and 0 anyway, so it's safe. Smile
You're good at explaining this sort of thing, Dan; sounds like you should write a tutorial if you have time. Wink
KermMartian wrote:
Well, he's been making these text-based games for years, and while I'm sure they're fun, I think it's time for him to expand his knowledge rather than just sticking to what he knows. Smile
I've been programming in TI-BASIC (text games) for 3 1/2 years. This coming March will be the 4th year. Kinda getting boring doing the same thing for so long.
adamac15: Learn AxeParser! ... I made a mandelbrot viewer in BASIC, but it's sooo slow ... that's my motivation Smile ... and when it's done, you should learn OPIA too! It's more complex than Axe and requires external tools, but brings OOP to z80 Smile
http://tinyurl.com/z80opia
I tried AxeParser one time, didn't work out (like other languages I've tried to learn (Java, Python, etc.))(mainly because I don't know how to program in those languages, probably). Sad
adamac15 wrote:
KermMartian wrote:
Well, he's been making these text-based games for years, and while I'm sure they're fun, I think it's time for him to expand his knowledge rather than just sticking to what he knows. Smile
I've been programming in TI-BASIC (text games) for 3 1/2 years. This coming March will be the 4th year. Kinda getting boring doing the same thing for so long.
Indeed, which is why I think you should expand your prowess. Smile It sounds to me as if you aren't getting the basic problem-solving concepts of program flow, and that once that clicks into place for you, all these other languages will make sense to you.
KermMartian wrote:
Indeed, which is why I think you should expand your prowess. Smile It sounds to me as if you aren't getting the basic problem-solving concepts of program flow, and that once that clicks into place for you, all these other languages will make sense to you.
It's just that when I look at the code, my mind goes like "ARGGGGGHHHHH!!!!" and I can't read it yet, but when I understand the code, I'll be alright.
I've noticed you have been continuously bumping this thread, but you haven't posted any signs of progress here yet. Do you have anything new to share?
Well, not really. Haven't been working on ARG 5 for a while. I added some stuff to it yesterday, but not enough to post it. I'll probably add more to it (since today is Homecoming day for my school). We'll be in the Gym for 2 hours, so gotta do something. Wink

EDIT: Got nothing done. I got lazy and read a book. Sad
*bump!*

Added a little more to ARG 5. Will TRY to add even more later.

EDIT: Gonna TRY to do so over the long weekend after today.
*bump again*

Added even more to ARG 5. Going to get into it more as the day progresses. And hopefully over the weekend (after school and the rest of the day of course, going to a dance with my girlfriend)

EDIT: Added a LOT more to it during 1st period. Now I'm halfway done with it. (WoooooHooooo)
*bumped one more time*

This whole time I've been making subprograms to put in to ARG, and so far I have 17 subprograms for 5 ARG games. It'll get confusing on which ones I'll need for one, but it'll manage (I hope).

More progress coming soon.........................................

EDIT: Adding more right now............ Will post when completed (and when I start on ARG 6 (yes there will be a 6th ARG))
*bump (kinda tired of bumping)( Just Joking )*

ARG 5 is now done (As of yesterday). Will work on ARG 6 as soon as possible. I know this is kinda boring, but I have no way to post screenies or put the files on my computer right now (having no internet at home (probably won't for a while), have no computer to calc link, and I can't upload and download from school, so I'm basically stuck.

Again, sorry for the lack of screenies.
Do any of your friends have internet at home? If so, you could ask them to install TI-Connect or TiLP and then you could post screenshots.
Or better yet, if you could get one of them to transfer the file to their computer and email it to you, you could use an emulator to take screenshots!
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 3 of 4
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement