Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
I have started to dabble in the ti-basic language, and I wanted to make a program that I could share with my friends, with a few easter eggs for them. It is basically a small simulator of the average life, (with a few twists), where you get to choose how you spend your time, and in turn, accept or deny opportunities given to you. It could be considered an RPG, but it might be the most basic RPG ever made

I have done just about nothing, only written out the basic "storyline" of the program, and what I hope to include.

[b]
Features (Hopefully)

The ability to make choices that affect your future
A semi-easy to navigate menu system
An easy way to waste some time
A list of stats that you have developed
Hopefully, a save system (I'm still pretty much a child in the world of coding)
A semi-interesting plot
And anything else I think of on the way

If anyone has any advice or a feature I could include, I would love to hear it!

*EDIT*
I am coding this for the Ti-84 Plus CE. As of now it will only text-based, I don't know how to make fancy graphics Very Happy.
Ok so 2 questions come to mind:

  1. Do you want this to be a very graphics heavy RPG like Link's Awakening or Pokemon Blue, or rather just a text-based game like The Oregon Trail?
  2. What calculator are you writing this on? There are various tools available like xLIBC, ICE Compiler and AXE, which can really help when writing games on calculators, but the ones you can use depends on your calculator model.

As for the features list, I see that a lot of features are things that aren't very insightful in terms of what the game might look like ('An easy way to waste some time', 'A semi-interesting plot' and 'anything else I think of on the way'... However, the other features are very realizable.
mr womp womp wrote:
Ok so 2 questions come to mind:

  1. Do you want this to be a very graphics heavy RPG like Link's Awakening or Pokemon Blue, or rather just a text-based game like The Oregon Trail?
  2. What calculator are you writing this on? There are various tools available like xLIBC, ICE Compiler and AXE, which can really help when writing games on calculators, but the ones you can use depends on your calculator model.

As for the features list, I see that a lot of features are things that aren't very insightful in terms of what the game might look like ('An easy way to waste some time', 'A semi-interesting plot' and 'anything else I think of on the way'... However, the other features are very realizable.


Thanks for your input! I was about half asleep when I made this post and there are lots of obvious errors, most of which you mentioned. I really appreciate your feed back!
Would you want to do this using menus, user input, on the graphscreen, on the homescreen, or what? Do you have any specific ideas?
jcgter777 wrote:
Would you want to do this using menus, user input, on the graphscreen, on the homescreen, or what? Do you have any specific ideas?


As of now, I'm using the base Menu() token to test my code and make an early useable version that I can show some people at my school. I hope to use the graph screen to display the stage in life you are in, your age, and your stats, (as of now intelligence, charisma, athleticism, and luck). I have now also programmed in "random" events based on age, and the level of certain skills. It is hard to explain what I want to do with the program, but I hope to have a basic form of it up to download soon. Maybe in the next week. Thanks for your input. Good Idea Smile
Finally implemented a rudimentary save system, that works with decent success. I have also begun work on the second phase of life. Money is implemented, and the ability to go to a college to further your skills.
I got a little bored and decided to bring this project back, just for fun. I made the obvious decision to move it over to the graph screen, which I hope will make it a more user-friendly "game".

Right now, I am remaking the Intro screen. One problem I have run into is not being to press enter to continue while the looping loading animation takes place. I put getKeys inside of the for loops, but it still doesn't work.

Code:

FnOff :AxesOff:0->Xmin:0->Ymin:164->Xmax:264->Ymax:ClrDraw
Text(60,35,"Welcome to my game of life.
Text(75,25,"This was made by Tate McCauley
60->A:55->B:0->K
While K!=105
   getKey->K
   Text(105,90,"Press Enter
   Lbl A
   getKey->K
   For(C,1,10,1
      getKey->K
      Circle(A,B,5,Blue
      A+4->A
   End
   For(C,1,10,1
      getKey->K
      Circle(A,B,5,White
      A-4->A
   End
   Goto A
End
ClrDraw
Text(1,1,"This is life. Here you will grow and
Text(15,1,"learn

If you have a fix, please let me know!
The while command checks to see if the variable is not equal to enter after the entire block of code has been run, so the other 2 getkeys in the loop are unnecessary. The calculator also cannot check for keypresses while it's drawing circles, so you'd have to continually press enter and hope it catches it to exit. I'm sorry I can't provide a more detailed explanation, I'm on a trip right now.
OldNewTimer wrote:
The while command checks to see if the variable is not equal to enter after the entire block of code has been run, so the other 2 getkeys in the loop are unnecessary. The calculator also cannot check for keypresses while it's drawing circles, so you'd have to continually press enter and hope it catches it to exit. I'm sorry I can't provide a more detailed explanation, I'm on a trip right now.

Ok, that makes sense. I think I will just remove the circle drawing for now and get down into the meat of the program.

EDIT: With every question solved, a new one arrises. As I am now trying to do this all on the graph screen, how do I get user input? I had a couple ideas.

1. Use the get key to take the key presses, and then change the getKey value to the corresponding letter. The problem with this is I don't know how to efficiently check to see what the getKey value is and then display the letters. Then I would have to store in a string I guess.

2. I could get rid of things like putting in names, and just have it be a one or the other choice, with the picture of a splitting road, and the user uses either the left or right arrow.


I'm not sure what would be best, and if you have a different idea, please post it below.
Here you go: http://tibasicdev.wikidot.com/custominput
I have tried to make my program check to make sure what the user inputs into a string is a valid answer. Right now, all I want is to make sure they pick one of two choices, but I don't the correct syntax. I tried what I thought would work:

Code:

If inString(Str2 not("FAMILY" or not("SELF
Then
   Text(145,1,"             
   Text(145,1,"Invalid input
   Pause
   Text(145,1,"               
End


But as I thought it would, it just gives a syntax error. What token am I missing?
21tmccauley wrote:
I have tried to make my program check to make sure what the user inputs into a string is a valid answer. Right now, all I want is to make sure they pick one of two choices, but I don't the correct syntax. I tried what I thought would work:

Code:

If inString(Str2 not("FAMILY" or not("SELF
Then
   Text(145,1,"             
   Text(145,1,"Invalid input
   Pause
   Text(145,1,"               
End


But as I thought it would, it just gives a syntax error. What token am I missing?

The syntax for the inString() command is as follows:

Code:
inString(SourceString,SearchString,[start])

And it returns the position of the substring in the source string. If there is no occurence of the substring in the source string, then the inString() command will return 0. The third argument is optional and specified a starting position in the string, if you only want to search from a certain point onward in the string.
I haven't bothered to read through the whole topic, but if you want to check if the string is one of two words, then you should just use the = operator, which works on strings.
If you want to use inString(), then you are checking to see if the substring is contained in the source string, rather than whether or not the source string is the same as the desired string.
Here are the 2 methods:

Code:

If not(inString(Str2,"FAMILY")+inString(Str2,"SELF
Then
   Text(145,1,"             
   Text(145,1,"Invalid input
   Pause
   Text(145,1,"               
End
//checks if the words FAMILY or SELF are contained in Str2

Code:

If Str2!="FAMILY" and Str2!="SELF
Then
   Text(145,1,"             
   Text(145,1,"Invalid input
   Pause
   Text(145,1,"               
End
//checks if Str2 is FAMILY or SELF

You could use the inString() command to check the position of the words in your source string, for example if you wanted to check if the user's input began with the word FAMILY or SELF (but could contain more characters after), then you could do somethings like this:

Code:

If inString(Str2,"FAMILY")=1 or inString(Str2,"SELF")=1
Then
//the user's input begins with either FAMILY or SELF
End
Sounds like an awesome idea Very Happy . If you want some code that I wrote to get an idea on making choices that affect the future then click Here basically it's a small game that you need to raise your suspicion and not get scammed.
davidclue wrote:
Sounds like an awesome idea Very Happy . If you want some code that I wrote to get an idea on making choices that affect the future then click Here basically it's a small game that you need to raise your suspicion and not get scammed.

Thanks for that code, it was pretty interesting to look at. One thing that I'm sure you're ready to here is what is with all of the brackets and such? Anyways, Thanks!
I was trying to figure out how to make an interactive menu on the graph screen so that when you pushed the up or down arrows, it would highlight a certain line of text, and then when you press enter, it would run a sub-program. I came up with a way that kind of works, but I know that there has to be a more efficient way. I don't know if it would be better to store each option in a string or what.

Code:

For(A,1,36,1
   getKey->K
   Text(1,100,"School
   Line(0,238,180,238,Black
   Text(1,170,"Days Left: ",B
   Text(15,1,"Activites:
   Text(30,1,"Play tag (athleticism)" //c=1
   Text(45,1,"Study math (intellegence)" //c=2
   Text(60,1,"Flirt with girls/guys (charisma)" //c=3
   Text(75,1,"Play with some dice (Luck)" //c=4
   If K=25:C-1->C
   If K=24:C+1->C
   If C<1:4->C
   If C>4:1->C
   While C=1
      TextColor(Blue
      Text(30,1,"Play tag (athleticism)
   End
   While C=2
      TextColor(Blue
      Text(45,1,"Study math (intellegence)
   End
   While C=3
      TextColor(Blue
      Text(60,1,"Flirt with girls/guys (charisma)
   End
   While C=4
      TextColor(Blue
      Text(75,1,"Play with some dice (Luck)
   End
   If K=105 and C=1
   B-1->B
   //Run tag program
   If K=105 and C=2
   B-1->B
   //Run Math program
   If K=105 and C=3
   B-1->B
   //Run Charisma program
   If K=105 and C=4
   B-1->B
   //Run Dice program
End
21tmccauley wrote:
I was trying to figure out how to make an interactive menu on the graph screen so that when you pushed the up or down arrows, it would highlight a certain line of text, and then when you press enter, it would run a sub-program. I came up with a way that kind of works, but I know that there has to be a more efficient way. I don't know if it would be better to store each option in a string or what.

Code:

For(A,1,36,1
   getKey->K
   Text(1,100,"School
   Line(0,238,180,238,Black
   Text(1,170,"Days Left: ",B
   Text(15,1,"Activites:
   Text(30,1,"Play tag (athleticism)" //c=1
   Text(45,1,"Study math (intellegence)" //c=2
   Text(60,1,"Flirt with girls/guys (charisma)" //c=3
   Text(75,1,"Play with some dice (Luck)" //c=4
   If K=25:C-1->C
   If K=24:C+1->C
   If C<1:4->C
   If C>4:1->C
   While C=1
      TextColor(Blue
      Text(30,1,"Play tag (athleticism)
   End
   While C=2
      TextColor(Blue
      Text(45,1,"Study math (intellegence)
   End
   While C=3
      TextColor(Blue
      Text(60,1,"Flirt with girls/guys (charisma)
   End
   While C=4
      TextColor(Blue
      Text(75,1,"Play with some dice (Luck)
   End
   If K=105 and C=1
   B-1->B
   //Run tag program
   If K=105 and C=2
   B-1->B
   //Run Math program
   If K=105 and C=3
   B-1->B
   //Run Charisma program
   If K=105 and C=4
   B-1->B
   //Run Dice program
End


The code looks well to me I'm not a professional or anything but I would say for the end loop a better way of putting it would be this.


Code:
//Code before loop
If K=105
Then
If C=1
Then
   B-1->B
   //Run tag program
End
   If C=2
Then
   B-1->B
   //Run Math program
End
   If C=3
Then
   B-1->B
   //Run Charisma program
End
   If C=4
Then
   B-1->B
   //Run Dice program
End
End
//Code after loop


You need those Then and End commands to run multiple lines of code for each selection although a better way would be using Labels and Goto commands so something like this.


Code:
//Code before loop
If K=105 and C=1:Goto 1
   If K=105 and C=2:Goto 2
   If K=105 and C=3:Goto 3
   If K=105 and C=4:Goto 4

Lbl 1
   B-1->B
   //Run tag program
//make sure at the end of your code here you put a goto or return command or else it will run Lbl 2
Lbl 2
B-1->B
   //Run Math program
//return or a goto command
Lbl 3
   B-1->B
   //Run Charisma program
//return or goto command
Lbl 4
   B-1->B
   //Run Dice program
//return or goto command


I only recommend using the goto method for if there is a lot of lines of code for each selection.
I have just finished up school and I want to start finishing up my many projects. For this project, I am still stuck with trying to make a custom menu. I have it all set up, but I can't figure out how to let the user choose a different option using getKey

Code:

1->C
36->B
ClrDraw
For(A,1,36,1
   getKey->K
   Text(1,100,"School
   Line(0,238,180,238,Black
   Text(1,170,"Days Left: ",B
   Text(15,1,"Activites:
   Text(30,1,"Play tag (athleticism)" //c=1
   Text(45,1,"Study math (intellegence)" //c=2
   Text(60,1,"Flirt with girls/guys (charisma)" //c=3
   Text(75,1,"Play with some dice (Luck)" //c=4
   If K=25:C-1->C
   If K=24:C+1->C
   If C<1:4->C
   If C>4:1->C
   While C=1
      TextColor(Black
      Text(30,1,"Play tag (athleticism)
   End
   While C=2
      TextColor(Black
      Text(45,1,"Study math (intellegence)
   End
   While C=3
      TextColor(Black
      Text(60,1,"Flirt with girls/guys (charisma)
   End
   While C=4
      TextColor(Black
      Text(75,1,"Play with some dice (Luck)
   End
   If K=105 and C=1
   B-1->B
   //Run tag program
   If K=105 and C=2
   B-1->B
   //Run Math program
   If K=105 and C=3
   B-1->B
   //Run Charisma program
   If K=105 and C=4
   B-1->B
   //Run Dice program
End
21tmccauley wrote:
I have just finished up school and I want to start finishing up my many projects. For this project, I am still stuck with trying to make a custom menu. I have it all set up, but I can't figure out how to let the user choose a different option using getKey

Code:

1->C
36->B
ClrDraw
For(A,1,36,1
   getKey->K
   Text(1,100,"School
   Line(0,238,180,238,Black
   Text(1,170,"Days Left: ",B
   Text(15,1,"Activites:
   Text(30,1,"Play tag (athleticism)" //c=1
   Text(45,1,"Study math (intellegence)" //c=2
   Text(60,1,"Flirt with girls/guys (charisma)" //c=3
   Text(75,1,"Play with some dice (Luck)" //c=4
   If K=25:C-1->C
   If K=24:C+1->C
   If C<1:4->C
   If C>4:1->C
   While C=1
      TextColor(Black
      Text(30,1,"Play tag (athleticism)
   End
   While C=2
      TextColor(Black
      Text(45,1,"Study math (intellegence)
   End
   While C=3
      TextColor(Black
      Text(60,1,"Flirt with girls/guys (charisma)
   End
   While C=4
      TextColor(Black
      Text(75,1,"Play with some dice (Luck)
   End
   If K=105 and C=1
   B-1->B
   //Run tag program
   If K=105 and C=2
   B-1->B
   //Run Math program
   If K=105 and C=3
   B-1->B
   //Run Charisma program
   If K=105 and C=4
   B-1->B
   //Run Dice program
End×


Could you tell me the problem your having?
I think I see a few problems in your code.
So you want the menu to loop until the enter key is pressed correct? So you need to stuff lines 14-17 into a Repeat loop.

Code:

1->C
36->B
ClrDraw
For(A,1,36,1
   Text(1,100,"School
   Line(0,238,180,238,Black
   Text(1,170,"Days Left: ",B
   Text(15,1,"Activites:
   Text(30,1,"Play tag (athleticism)" //c=1
   Text(45,1,"Study math (intellegence)" //c=2
   Text(60,1,"Flirt with girls/guys (charisma)" //c=3
   Text(75,1,"Play with some dice (Luck)" //c=4

Repeat K=105
getKey->K
   If K=25:C-1->C
   If K=24:C+1->C
   If C<1:4->C
   If C>4:1->C
End
//...
End

Now for lines 14-17 this can be optimized to

Code:
max(1,min(4,C+sum(ΔList(K={25,34→C

This sets the lowest value to 1, the highest value to 4.
Delta list is kinda complex but it'll return either 1 or -1 depending if K=25 or 34 (it'll return 0 if it's neither). It then adds that result to C's original value. This is what increases or decreases the value of C.
So now you have

Code:

1->C
36->B
ClrDraw
For(A,1,36,1
   Text(1,100,"School
   Line(0,238,180,238,Black
   Text(1,170,"Days Left: ",B
   Text(15,1,"Activites:
   Text(30,1,"Play tag (athleticism)" //c=1
   Text(45,1,"Study math (intellegence)" //c=2
   Text(60,1,"Flirt with girls/guys (charisma)" //c=3
   Text(75,1,"Play with some dice (Luck)" //c=4

Repeat K=105
getKey->K
max(1,min(4,C+sum(ΔList(Ans={25,34→C //note: I changed the K to Ans since the getKey was the line immediately above this one.
End
//...
End


Now here's an issue, you're using a While loop which will repeat until C does not equal <number> but you never change the value of C in the loop so it creates an infinite loop. Some nested If:Then:Else statements would be better suited.


Code:

If C=1
Then
      TextColor(Black
      Text(30,1,"Play tag (athleticism)
Else
If C=2
Then
      TextColor(Black
      Text(45,1,"Study math (intellegence)
Else
If C=3
Then
      TextColor(Black
      Text(60,1,"Flirt with girls/guys (charisma)
Else
If C=4
Then
      TextColor(Black
      Text(75,1,"Play with some dice (Luck)
   End
   End
   End
   End

This can be optimized, but that would take a while for me to do so this should be good enough.

Now another issue with your code, you have
If K=105 and C=1
B-1->B
//Run tag program
But you don't have a Then command, therefore the If statements only applies to the B-1->B. This means that the tag program will always be run.
I'm not sure if you mean by run tag program, so I'll assume you're jumping to a subprogram.
You shouldn't ever jump to a subprogram within an If:Then statement since it creates a memory leak.
You can however, jump to a subprogram within just an If statement.


Code:
If max(K={1,2,3,4 //this checks if K= 1, 2, 3, or 4
B-1->B// I added this since you do this anyways in all your If statements.
If C=1//since K [b]must[/b] = 105 to have escaped the loop above so you can remove all the K=105
   //Run tag program
   If C=2
   //Run Math program
   If C=3
   //Run Charisma program
   If C=4
   //Run Dice program

So final result

Code:

1->C
36->B
ClrDraw
For(A,1,36,1
   Text(1,100,"School
   Line(0,238,180,238,Black
   Text(1,170,"Days Left: ",B
   Text(15,1,"Activites:
   Text(30,1,"Play tag (athleticism)" //c=1
   Text(45,1,"Study math (intellegence)" //c=2
   Text(60,1,"Flirt with girls/guys (charisma)" //c=3
   Text(75,1,"Play with some dice (Luck)" //c=4

Repeat K=105
getKey->K
max(1,min(4,C+sum(ΔList(Ans={25,34→C
End

If C=1
Then
      TextColor(Black
      Text(30,1,"Play tag (athleticism)
Else
If C=2
Then
      TextColor(Black
      Text(45,1,"Study math (intellegence)
Else
If C=3
Then
      TextColor(Black
      Text(60,1,"Flirt with girls/guys (charisma)
Else
If C=4
Then
      TextColor(Black
      Text(75,1,"Play with some dice (Luck)
   End
   End
   End
   End
If max(K={1,2,3,4
B-1->B
   If C=1
   //Run tag program
   If C=2
   //Run Math program
   If C=3
   //Run Charisma program
   If C=4
   //Run Dice program

End

(hopefully that works)
Now you may want to add an indicator to where the cursor is currently at. If you need help with this just post and I'll try to help you. Smile
I tried to make it highlight the text that your cursor is over but it only works for a second after enter is pressed. I know right now the code is very redundant, but I was trying to see that method would even work. (It doesn't)

Code:

1->C
36->B
ClrDraw
For(A,1,36,1
   TextColor(Black
   Text(1,100,"School
   Line(0,238,180,238,Black
   Text(1,170,"Days Left: ",B
   Text(17,1,"Activites:
   Text(32,1,"Play tag (athleticism)" //c=1
   Text(47,1,"Study math (intellegence)" //c=2
   Text(62,1,"Flirt with girls/guys (charisma)" //c=3
   Text(77,1,"Play with some dice (Luck)" //c=4

Repeat K=105
   getKey->K
   max(1,min(4,C+sum(DeltaList(Ans={25,34->C
End
If C=1
Then
   TextColor(Blue
   Text(32,1,"Play tag (athleticism)"
   TextColor(Black
   Text(47,1,"Study math (intellegence)"
   Text(62,1,"Flirt with girls/guys (charisma)"
   Text(77,1,"Play with some dice (Luck)"
   Else
   If C=2
   Then
      TextColor(Blue
      Text(47,1,"Study math (intellegence)"
      TextColor(Black
      Text(62,1,"Flirt with girls/guys (charisma)"
      Text(77,1,"Play with some dice (Luck)"
      Text(32,1,"Play tag (athleticism)"
      Else
      If C=3
      Then
         TextColor(Blue
         Text(62,1,"Flirt with girls/guys (charisma)"
         TextColor(Black
         Text(77,1,"Play with some dice (Luck)"
         Text(32,1,"Play tag (athleticism)
         Text(47,1,"Study math (intellegence)"
         Else
         If C=4
            Then
               TextColor(Blue
               Text(77,1,"Play with some dice (Luck)"
               TextColor(Black
               Text(32,1,"Play tag (athleticism)
               Text(47,1,"Study math (intellegence)"
               Text(62,1,"Flirt with girls/guys (charisma)"
               End
         End
      End
   End
If max(K={1,2,3,4
B-1->B
   If C=1
   //Run tag program
   If C=2
   //Run Math program
   If C=3
   //Run Charisma program
   If C=4
   //Run Dice program

End
  
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 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