Dark Hallways, my first major game, will hopefully be completed within this semester. Dark Hallways is a text-based mystery game set in the year 2033 in an old, abandoned school. It is menu based, where the player selects an option to continue through the adventure.

It is a pure BASIC program, not an App, however if it turns out good and people really like it, it could possibly be made into an App.

Currently, most of the game, is done, but because I wrote the program before I knew much about TI-BASIC, I have approximately 50+ labels and A TON of memory leaks. I am currently working on eliminating labels and mem leaks, changing menus to custom menus (but trying to keep it as small as possible), adding some more plot story to the game, and eliminating possible plotholes.

Question: Should I include the intro story in the program? It is about half a page long(on paper).
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Also, I created a unique menu for my game:

Here's the code for it, so if anyone wants to, can you optimize it?

Code:

:ClrHome:ClrDraw:CoordOff:GridOff:AxesOff:FnOff :PlotsOff
:0→Xmin:1→ΔX
:0→Ymin:1→ΔY
:For(A,42,46
:Horizontal A
:Horizontal A+16
:End
:"BEGINABOUTQUIT "→Str1
:Text(28,10,sub(Str1,1,5
:Text(38,10,sub(Str1,6,5
:Text(48,10,sub(Str1,11,5
:"dark hallways
:Text(-1,7,9,Ans
:StorePic 2
:Text(-1,7,10,Ans
:RecallPic2
:DelVar Pic228→A
:27→B
:Repeat A=28
:Repeat sum(K={105,26
:getKey→K
:Text(-1,A,10,sub(Str1,A-B,5
:If sum(K={25,34
:Then
:Text(-1,A,10,"      //8 spaces
:Text(A,10,sub(Str1,A-B,5
:A+10(K=34)(A+10<49)-10(K=25)(A-10>27→A
:If A=28:27→B
:If A=38:32→B
:If A=48:37→B
:End:End
:If A=38:Then
:Text(28,55,"Coded by
:Text(A,51,"Michael23B
:Text(48,61,"2015
:End
:If A=48:Then
:ClrDraw
:ClrHome
:DelVar Str1
:Output(1,1,"
:Stop          //not sure if this causes a mem leak or not
:End
:If A≠28:Then
:Repeat sum(getKey={23,24,45
:End:End
:For(I,28,48,10
:Text(-1,I,50,"       //14 spaces
:End:End
**main code**


Considering the title "Dark Hallways", I'm thinking that it might look really good if I inverted the colors, so that most of it is black. However that would require an Assembly hex code or two. Should I do it?
Michael2_3B wrote:
Considering the title "Dark Hallways", I'm thinking that it might look really good if I inverted the colors, so that most of it is black. However that would require an Assembly hex code or two. Should I do it?

Sure, that sounds neat! What sections would you like as inverted? Also, if you would like more information with working with hex codes and such, feel free to ask! Smile

In addition, I believe DoorsCS allows for inline assembly, so that should make it so you don't need a separate program to do those kind of things. Smile
MateoConLechuga wrote:
Michael2_3B wrote:
Considering the title "Dark Hallways", I'm thinking that it might look really good if I inverted the colors, so that most of it is black. However that would require an Assembly hex code or two. Should I do it?

Sure, that sounds neat! What sections would you like as inverted? Also, if you would like more information with working with hex codes and such, feel free to ask! Smile

In addition, I believe DoorsCS allows for inline assembly, so that should make it so you don't need a separate program to do those kind of things. Smile


I think inverting everything would look good(including the text), but the 2 big bars surrounding "dark hallways" might not look as good in white. Keeping them as black while still inverting everything else would still not look good however, so I'm thinking that I may just make them thinner (and change them to white), or make it more visually appealing by making it more graphical. Who knows, maybe I could add something like vines hanging down from it just to make it look cooler. However, the more complex the graphics are, I would probably need to use a picture variable, which is only obtainable by taking it from my calculator and sending it to my computer (I don't have a cable or anything, just my calc). But now that I think about it, can't you just take a Pic variable directly from the emulator?

EDIT: Also, I'm trying to keep everything pure BASIC, so that I don't have to mess around with DoorsCS or anything...
Whatever you prefer sounds good! Smile You can take the pic variables from jsTIfied by refreshing the variable list, and from Wabbit by pressing View and then variables. Smile If you need any hex codes that you would like to use, we are here to help! Smile

EDIT: Ah, I understand that keeping this in pure basic is a general idea. I preferred to have things run standalone as well, as it just made things that much simpler. Smile
I like how you used the offset Text() to create that title.

You asked for some optimizations:


Code:
If A=28:27→B
If A=38:32→B
If A=48:37→B
can be
Code:
.5Ans+13→B



I prefer to keep a getKey within a tight loop so that less code has to be run everytime a key is pressed.

Code:
ClrHome:ClrDraw:CoordOff:GridOff:AxesOff:FnOff :PlotsOff
0→Xmin:1→∆X
0→Ymin:1→∆Y
For(A,42,46
  Horizontal A
  Horizontal A+16
End
"BEGINABOUTQUIT "→Str1
Text(28,10,sub(Str1,1,5
Text(38,10,sub(Str1,6,5
Text(48,10,sub(Str1,11,5
"dark hallways
Text(⁻1,7,9,Ans
StorePic 2
Text(⁻1,7,10,Ans
RecallPic 2
DelVar Pic228→A
1→B
Repeat A=28
  Repeat sum(K={105,26
    Text(⁻1,A,10,sub(Str1,B,5
    Repeat Ans:getKey→K:End
    If sum(K={25,34:Then
      Text(⁻1,A,10,"       
      Text(A,10,sub(Str1,B,5
      A+10(K=34)(A<39)-10(K=25)(A>37→A
      .5Ans-13→B
    End
  End
  If A=38:Then
    Text(28,55,"Coded by
    Text(A,51,"Michael23B
    Text(48,61,"2015
  End
  If A=48:Then
    ClrDraw
    ClrHome
    DelVar Str1
    Output(1,1,"
    Stop
  End
  For(I,28,48,10
    Text(⁻1,I,50,"             
  End
End
Just be sure to define B as 1 before all of the loops for the above code to work.

Edit: Take note that the about text only flashes now. I am sure you can fix that somehow.
What do you mean the about text? If it does flash, I certainly don't notice it.

EDIT: Also, a simple addition if I wanted to add it:

Code:

PROGRAM:RUNIND
:AsmPrgmEF7045C9

and then, directly before "Repeat A=28",this:

Code:

:Asm(prgmRUNIND


Again, I don't want to mess around too much with ASM or Doors, so this will probably be one of the few ASM things I add in. Do you think it is even worth turning the run indicator off?
I forgot to include the entire code. I edited my post above.
Ahh, I see what you mean now by the About text only flashing for a second. Why did you remove some of the code? just do this:

Code:

If A=38:Then
Text(28,55,"Coded by
Text(A,51,"Michael23B
Text(48,61,2015
Repeat sum(getKey={24,45
End:End
So you can't exactly do it that way; you would need to have a different assembly snippet that does that for you. Here you are! Smile


Code:
AsmPrgm
EFD74A
EFEF4A3D
281D3D
2810
FDCB055E
2005
FDCB05DEC9
FDCB059EC9
21000011
5F3FEF5F
4DC9
EF7045C9


So, to use this, you can do:

Code:
1:Asm(prgmASM

to turn off the indicator, and

Code:
2:Asm(prgmASM

To invert the screen

Code:
3:Asm(prgmASM

To toggle text inversion

Hope this helps! Smile
MateoConLechuga wrote:
So in theory, you could do something like

Code:
1:Asm(prgmASM

to turn off the indicator, and

Code:
2:Asm(prgmASM

To invert the screen

Code:
3:Asm(prgmASM

To shift the screen

Code:
4:Asm(prgmASM

To perform something pretty quickly.

You can have a single asm program do all of these things, and anything else just by specifying what is in Ans.


I'm sorry, could you elaborate more? So if I wanted to do

Code:

PROGRAM:ASM
:AsmPrgm21F5893E08AE77C9         //text inverse
:
:AsmPrgm210000115F3FEF5F4DC9    //screen inverse
:
:AsmPrgmEF7045C9    //run indicator off

in a single program, I would have to do Asm(prgmASM
How would I change what is activated inside prgmASM using Ans?
(Sorry, I hardly know anything about Assembly)

Edit: Also, as I stated earlier, I have the intro story done, but I'm wondering: Should I include the intro story in the program? It is about half a page long(on paper).
So you can't exactly do it that way; you would need to have a different assembly snippet that does that for you. Here you are! Smile


Code:
    3 00:0000 -  -  -  -  .org      $9D93
    4 00:9D93 -  -  -  -  .list
    5 00:9D93 -  -  -  - 
    6 00:9D93 - - -  -     .db    $BB,$6D
    7 00:9D95 EF D7 4A -     bcall(_RclAns)
    8 00:9D98 EF EF 4A -     bcall(_ConvOP1)         ; A = LSB
    9 00:9D9B 3D -  -  -     dec a
   10 00:9D9C 28 1D -  -     jr z,RunOff
   11 00:9D9E 3D -  -  -     dec a
   12 00:9D9F 28 10 -  -     jr z,ScreenInvert
   13 00:9DA1 -  -  -  -  TextInvert:
   14 00:9DA1 FD CB 05 5E    bit textInverse,(IY+textFlags)
   15 00:9DA5 20 05 -  -     jr nz,Resest
   16 00:9DA7 FD CB 05 DE    set textInverse,(IY+textFlags)
   17 00:9DAB C9 -  -  -     ret
   18 00:9DAC -  -  -  -  Resest:
   19 00:9DAC FD CB 05 9E    res textInverse,(IY+textFlags)
   20 00:9DB0 C9 -  -  -     ret
   21 00:9DB1 -  -  -  -  ScreenInvert:
   22 00:9DB1 21 00 00 11
              5F 3F EF 5F
              4D -  -  -     .db $21,$00,$00,$11,$5F,$3F,$EF,$5F,$4D
   23 00:9DBA C9 -  -  -     ret
   24 00:9DBB -  -  -  -  RunOff:
   25 00:9DBB EF 70 45 -     bcall(_RunIndicOff)      ; Turn Off Run Indicator
   26 00:9DBE C9 -  -  -     ret

Of course, I'm sure this could use some optimization, but anywho, here is the direct opcodes you will need, so that way you won't have to look above:

Code:
AsmPrgm
EFD74A
EFEF4A3D
281D3D
2810
FDCB055E
2005
FDCB05DEC9
FDCB059EC9
21000011
5F3FEF5F
4DC9
EF7045C9


So, to use this, you can do:

Code:
1:Asm(prgmASM

to turn off the indicator, and

Code:
2:Asm(prgmASM

To invert the screen

Code:
3:Asm(prgmASM

To toggle text inversion

Hope this helps! Smile
Thanks Mateo!

Also, can this code be optimized some? I know it's already fairly small, but here it is:

Code:

14→dim(ʟDARK
Fill(0,ʟDARK
14→ʟDARK(9
randInt(2010,2015→ʟDARK(1
randInt(2016,2019→ʟDARK(2
randInt(2020,2025→ʟDARK(3
randInt(2026,2029→ʟDARK(4
((ʟDARK(2)-ʟDARK(1))x100)+((ʟDARK(3)-ʟDARK(2))x10)+(ʟDARK(4)-ʟDARK(3→ʟDARK(5

Note: Storing the random numbers to each individual list element, instead of just putting it all into the last line, is necessary, because they are displayed later.

Also, an update:
The intro story is done. I don't want the display of it to be too complicated, but I will still try to make it "cool". Also, I may add a skip intro option. If it's not too hard, I also may add a short cutscene, but most likely not because that is fairly hard to do in BASIC, and have it look good.
Cool, a story sounds pretty neat! Smile Anywho, here is an optimized version of the code that you might like. Not sure if it is the most optimized; probably could shorten it, but meh.


Code:
seq(randInt(2010+6X-2(X>1),2015+4X+2(X>1)),X,0,3->DARK
(e2(Ans(2)-Ans(1)))+(10(Ans(3)-Ans(2)))+Ans(4)-Ans(3->ʟDARK(5
14->dim(ʟDARK
Ans->ʟDARK(9


The little 'e' in there is the double e thing... It's the 2nd key of the ',' key. Smile Hope this helps! Smile

EDIT: About 83 bytes saved. Razz
Nice! It does seem to slow down the program though.

Also, I made a small change in loading the text:

Code:

"BEGINABOUTQUIT "→Str1
Text(28,10,sub(Str1,1,5

can be

Code:

"BEGINABOUTQUIT "→Str1
Text(-1,28,10,sub(Str1,1,5

instead of having the loop activate it, that way it doesn't flash small text and then half a second later it becomes big. Just my opinion, but it looks better that way.

Edit:Why does my code sometimes have a bunch of spaces in it, like the first block of code in this post? In the preview it looks fine, but on the main thread it has spaces in it...
Just going to drop this in here in case you find it useful.

Code:
AsmPrgm:FD7E05
E608
EF8C47
EFBF4A
C9

That should return zero in Ans if the text flag is not set to inverted. Some other number if it is.
Okay, this is my current code. I know it's probably very inefficient (plus I have 2 different hex codes in 2 different programs), so could someone make this as small/efficient as possible? As you can probably tell, I'm not very good with ASM...

Code:

ClrDraw
DispGraph  //make sure graph is being displayed so that graph screen is filled with black pixels
Asm(prgmZBLK   //hex code for filling in screen with black pixels
Asm(prgmZTEXT   //hex code for inverting text

Text(57,93,".
If pxl-Test(62,93   //if text is black, then..
Asm(prgmZTEXT   //change it to white

For(A,93,94
Line(A,0,A,5   //fills in the "." that was used to test for black/white text
End
Text(2,2,"YOU WAKE UP ON THE FLOOR,   //this is where the intro story starts to display


And here's the other programs:
prgmZBLK(fills screen with black pixels):

Code:

AsmPrgm210000115F3FEF624DC9

prgmZTEXT(inverts text):

Code:

AsmPrgm21F5893E08AE77C9
Michael, I'm going to continue to recommend that you use ExecHex from Doors CS (plus the proper DCS guard code) so you won't have lots of little ASM programs to distribute with your game.
KermMartian wrote:
Michael, I'm going to continue to recommend that you use ExecHex from Doors CS (plus the proper DCS guard code) so you won't have lots of little ASM programs to distribute with your game.

As I have said earlier, I'm trying to use as little ASM as possible, and I'm not really wanting to mess around with DCS or anything like that. I know, I know, using it would make my game a lot better, but honestly I would just prefer to keep my game as BASIC as possible.

Thus the reason why I've already considered not using ASM at all. It won't change my game by much, but I was just thinking that changing some of the graphics would make it look better (such as making the screen black and inverting text).
I'm going to agree with Kerm on this one. DoorsCS has many useful features that will make making this program many times easier, plus you won't have to execute another program in order to do all of those things. You can do all of those things and more with DoorsCS... Smile
I'm still trying to keep it as basic as possible, but I'm just trying to do some small things to make it look cooler...

Basically what I am wanting is a single AsmPrgm that can turn off the run indicator, fill the screen with black pixels, and invert text. If the text is black (if the text was already inverted), then something like :3:Asm(prgmASM will be run again to invert the text again, so that it will always be white text.

EDIT: so basically, this is how it would probably work:

Code:
:1:Asm(prgmZASM

would turn off run indicator

Code:
:2:Asm(prgmZASM

would fill screen with black pixels

Code:
:3:Asm(prgmZASM

would invert text
  
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 1 of 2
» All times are UTC - 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