Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
25 May, 2013, 12:16:38 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: [1] 2   Go Down
  Print  
Author Topic: TI-nspire Hold 'em - Basic and Lua -  (Read 1966 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
Jonius7
aka jhgenius
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: 20 May, 2013, 06:58:52
Date Registered: 03 September, 2010, 02:50:11
Location: Gold Coast, Australia
Posts: 1743


Topic starter
Total Post Ratings: +50

View Profile WWW
« on: 11 April, 2012, 14:27:02 »
+1

Hi,

When I got the TI-nspire Clickpad in 2010, there was one game that I started developing in May, before anything else...
This game has 2400+ downloads on ticalc.org... is my most completed TI-nspire Basic game... certainly my most well known (expect for possibly Health Bar Tongue)...
Considering I had topics for my other (incomplete and possibly stalled) projects, I did not have a topic for my best game:

(Jason's) TI-nspire Holdem! (click for ticalc.org link!)

I have decided to create this long overdue topic to post on past and current progresses in this game!
This project has a bright future, where I have (mostly) finished with the Basic version, it has great potential for a great graphical Lua game!


I must also say that this program was originally based on Matt Oslan's poker dealer game (which is was the most downloaded TI-nspire Basic Game shocked)
However it has evolved and is now completely different, possibly using 90% now using 98% of my own code.

In my latest version yet to be released I have made huge optimisations in cuttting down some programs from 157 lines of code to just 3 315 lines to 5 and 472 lines to 7 by adding a list somewhere in another program linked to it.

My focus now is shifting development to adding detection of poker hands (determining whether you have a royal flush or a pair for eg) and AI. With Lua I can also develop a graphical interface too!

This topic will have it all. (well maybe not). I need to make another announcement about my (new) website too. http://www.tistadium.co.cc (which is currently down and gone :O)

Latest BASIC version: v1.2.4


* TI-nspire Hold 'em v1.1.3.tns (16.28 KB - downloaded 33 times.)
« Last Edit: 22 November, 2012, 02:05:06 by Jonius7 » Logged



Userbars.com is down?
+9001
Intermediate TI-nspire Basic Programmer
Programmed some CASIO Basic in the past
DJ_O Music Discographist Wink
Userbars for these coming... in the process

My Released and Announced Projects (Updated 2013/01/29)
TI-nspire BASIC
TI-nspire Hold 'em | Health Bar | Scissors Paper Rock | Battle of 16s (stalled) | sTIck RPG (stalled) | Monopoly (stalled)

TI-nspire Lua
Numstrat | TI-nspire Hold 'em Lua | Terraria (coming soon)
Axe Parser
Doodle God (stalled while I go and learn some Axe)

Spoiler for Other Stuff:
Spoiler for Want your own HonestDownloads userbar?:
Hello! Do you want to show your affection for my website, HonestDownloads? Then here is a userbar I specially created earlier just for HonestDownloads users!

To add it to your signature just copy and paste the code below into your sig and you'll become an instant supporter of my website!

1
[URL=http://www.jhgenius01.webs.com][IMG]http://s1.bild.me/bilder/060112/3684792HDuserbaruser.png[/IMG][/URL]
Spoiler for My TI-nspire Basic Programs (Updated 2012/04/15):
***List of Programs in the TI-nspire Stadium***
Group Release 2012/04/07 on omnimaga.org

Games
   Noteable Release    ticalc.org Release Development/Not Publicly Released
2010/05/08 TI-nspire Hold 'em
   2012/04/07 v1.1.2   2012/04/10 v1.1.3  2012/04/14 v1.2.1
2010/08/03 Cosmic Legions
   2012/04/07 v0.2.2.2 (1st Release)
2010/08/12 Battle of 16s
   2012/04/07 v0.2.7
2010/09/10 Health Bar
   2012/04/07 v1.2     2012/04/02 v1.0   
2010/12/04 sTIck RPG
   2012/04/07 v0.1.5.2
2011/01/09 Monopoly
   2012/04/07 v0.16    (1st Release)
2012/04/09 Scissors Paper Rock
   2012/04/14 v0.8.1

Miscellaneous
2010/11/07 中文 (Chinese) Demonstration
   2012/04/07 v1.3     (1st Release)

Potential/Minor Programs
2010/09/26 Shanghai Metro
   2012/04/07 v0.2     (1st Release)
2010/12/22 TI-nspire Programming Tutorials
   2012/04/07 v0.1     (1st Release)
2010/12/28 Casino Games
   Was not released.
2011/04/22 Interlink
   2012/04/07 v0.0.4   (1st Release)
2012/03/22 Hierarchy
   2012/04/07 v0.01

Demo Programs (some may become Potential Programs)
2010/06/23 Monopoly (Board)
   2012/04/07 Prototype
2010/07/14 Strategy Battle
   2012/04/07 v0.12
2010/10/05 JRPG
   2012/04/07 v0.2
2010/11/02 PlotGrid
   2012/04/07 v0.2
2010/11/24 civilizaTIon™
   2012/04/07 v0.11

Purely Informational
2011/01/05 TI-nspire Stadium Changelog
   2012/04/07 v2
   Created to list significant releases of my programs. A page similar to this List of Programs in the TI-nspire Stadium was included in the documentation of most of my programs until sometime in Late 2011/Early 2012.

All games and programs coded in TI-nspire Basic.
© 2010-2012 Jason Ho.
Last Updated 14 April 2012

jhgenius01.webs.com
Will be moving! Stay tuned for updates.
Spoiler for Progress of Doodle God Axe:
2011/12/21 4% - Progress Suspended, ideas of graphical sprites still uncertain
Spoiler for Other Other You Know What Other Stuff I'm Talking About Stuff Stuff (Updated 2012/01/17):
ElementCoder
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Yesterday at 22:23:52
Date Registered: 22 May, 2011, 17:28:58
Location: Netherlands, Drachten
Posts: 411


Total Post Ratings: +26

View Profile
« Reply #1 on: 11 April, 2012, 16:56:07 »
0

Lua sounds great! I'll definitely want to see that happen.  Cheesy
Seeing how you improved your code, let's say it sounds very familiar Big smile Especially with my current project Tongue

P.S. Your list of programs in your stadium seems interesting. Is there a possibility I could have a look at the source/get all of em?
Logged

Calculators owned: TI-Nspire ClickPad (no batteries though Tongue); TI-Nspire CX
Known languages: TI BASIC (Nspire); Java; Lua; C++
Spoiler for Random stuff:

NerdTests.com says I'm a Nerd God.  Click here to take the Nerd Test, get nerdy images and jokes, and write on the nerd forum!


Omni search is down, use http://megapowers.net/v/search.htm instead.
Jonius7
aka jhgenius
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: 20 May, 2013, 06:58:52
Date Registered: 03 September, 2010, 02:50:11
Location: Gold Coast, Australia
Posts: 1743


Topic starter
Total Post Ratings: +50

View Profile WWW
« Reply #2 on: 11 April, 2012, 17:52:22 »
0

Lua sounds great! I'll definitely want to see that happen.  Cheesy
Seeing how you improved your code, let's say it sounds very familiar Big smile Especially with my current project Tongue

P.S. Your list of programs in your stadium seems interesting. Is there a possibility I could have a look at the source/get all of em?

It sounds very familiar? To what? I did create this game waaaay back in May 2010

Yes ElementCoder I have thought about releasing the source code and stuff. I have already released a whole rar file with most of my project in there in my General Projects Topic
www.omnimaga.org/index.php?topic=12865.0
« Last Edit: 11 April, 2012, 17:53:28 by Jonius7 » Logged



Userbars.com is down?
+9001
Intermediate TI-nspire Basic Programmer
Programmed some CASIO Basic in the past
DJ_O Music Discographist Wink
Userbars for these coming... in the process

My Released and Announced Projects (Updated 2013/01/29)
TI-nspire BASIC
TI-nspire Hold 'em | Health Bar | Scissors Paper Rock | Battle of 16s (stalled) | sTIck RPG (stalled) | Monopoly (stalled)

TI-nspire Lua
Numstrat | TI-nspire Hold 'em Lua | Terraria (coming soon)
Axe Parser
Doodle God (stalled while I go and learn some Axe)

Spoiler for Other Stuff:
Spoiler for Want your own HonestDownloads userbar?:
Hello! Do you want to show your affection for my website, HonestDownloads? Then here is a userbar I specially created earlier just for HonestDownloads users!

To add it to your signature just copy and paste the code below into your sig and you'll become an instant supporter of my website!

1
[URL=http://www.jhgenius01.webs.com][IMG]http://s1.bild.me/bilder/060112/3684792HDuserbaruser.png[/IMG][/URL]
Spoiler for My TI-nspire Basic Programs (Updated 2012/04/15):
***List of Programs in the TI-nspire Stadium***
Group Release 2012/04/07 on omnimaga.org

Games
   Noteable Release    ticalc.org Release Development/Not Publicly Released
2010/05/08 TI-nspire Hold 'em
   2012/04/07 v1.1.2   2012/04/10 v1.1.3  2012/04/14 v1.2.1
2010/08/03 Cosmic Legions
   2012/04/07 v0.2.2.2 (1st Release)
2010/08/12 Battle of 16s
   2012/04/07 v0.2.7
2010/09/10 Health Bar
   2012/04/07 v1.2     2012/04/02 v1.0   
2010/12/04 sTIck RPG
   2012/04/07 v0.1.5.2
2011/01/09 Monopoly
   2012/04/07 v0.16    (1st Release)
2012/04/09 Scissors Paper Rock
   2012/04/14 v0.8.1

Miscellaneous
2010/11/07 中文 (Chinese) Demonstration
   2012/04/07 v1.3     (1st Release)

Potential/Minor Programs
2010/09/26 Shanghai Metro
   2012/04/07 v0.2     (1st Release)
2010/12/22 TI-nspire Programming Tutorials
   2012/04/07 v0.1     (1st Release)
2010/12/28 Casino Games
   Was not released.
2011/04/22 Interlink
   2012/04/07 v0.0.4   (1st Release)
2012/03/22 Hierarchy
   2012/04/07 v0.01

Demo Programs (some may become Potential Programs)
2010/06/23 Monopoly (Board)
   2012/04/07 Prototype
2010/07/14 Strategy Battle
   2012/04/07 v0.12
2010/10/05 JRPG
   2012/04/07 v0.2
2010/11/02 PlotGrid
   2012/04/07 v0.2
2010/11/24 civilizaTIon™
   2012/04/07 v0.11

Purely Informational
2011/01/05 TI-nspire Stadium Changelog
   2012/04/07 v2
   Created to list significant releases of my programs. A page similar to this List of Programs in the TI-nspire Stadium was included in the documentation of most of my programs until sometime in Late 2011/Early 2012.

All games and programs coded in TI-nspire Basic.
© 2010-2012 Jason Ho.
Last Updated 14 April 2012

jhgenius01.webs.com
Will be moving! Stay tuned for updates.
Spoiler for Progress of Doodle God Axe:
2011/12/21 4% - Progress Suspended, ideas of graphical sprites still uncertain
Spoiler for Other Other You Know What Other Stuff I'm Talking About Stuff Stuff (Updated 2012/01/17):
ElementCoder
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Yesterday at 22:23:52
Date Registered: 22 May, 2011, 17:28:58
Location: Netherlands, Drachten
Posts: 411


Total Post Ratings: +26

View Profile
« Reply #3 on: 11 April, 2012, 20:04:36 »
0

It sounds very familiar? To what?
I mean reducing many lines of code into just a few lines. (say 300 to 20 becuase loops are more useful Tongue)
Logged

Calculators owned: TI-Nspire ClickPad (no batteries though Tongue); TI-Nspire CX
Known languages: TI BASIC (Nspire); Java; Lua; C++
Spoiler for Random stuff:

NerdTests.com says I'm a Nerd God.  Click here to take the Nerd Test, get nerdy images and jokes, and write on the nerd forum!


Omni search is down, use http://megapowers.net/v/search.htm instead.
AzNg0d1030
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: 19 May, 2013, 23:04:34
Date Registered: 26 October, 2011, 04:43:09
Location: Over the rainbow
Posts: 488


Total Post Ratings: +37

View Profile
« Reply #4 on: 12 April, 2012, 10:49:29 »
0

Jonius7, would you mind posting a screenie?
Logged

What? WHAT? WHATTTT?Huh??

You just lost the game.

Suck it up.
Jonius7
aka jhgenius
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: 20 May, 2013, 06:58:52
Date Registered: 03 September, 2010, 02:50:11
Location: Gold Coast, Australia
Posts: 1743


Topic starter
Total Post Ratings: +50

View Profile WWW
« Reply #5 on: 13 April, 2012, 08:33:10 »
0

Oh sorry I attached that quickly. All info is on the ticalc.org upload with some nice screenies!
http://www.ticalc.org/archives/files/fileinfo/430/43059.html
Logged



Userbars.com is down?
+9001
Intermediate TI-nspire Basic Programmer
Programmed some CASIO Basic in the past
DJ_O Music Discographist Wink
Userbars for these coming... in the process

My Released and Announced Projects (Updated 2013/01/29)
TI-nspire BASIC
TI-nspire Hold 'em | Health Bar | Scissors Paper Rock | Battle of 16s (stalled) | sTIck RPG (stalled) | Monopoly (stalled)

TI-nspire Lua
Numstrat | TI-nspire Hold 'em Lua | Terraria (coming soon)
Axe Parser
Doodle God (stalled while I go and learn some Axe)

Spoiler for Other Stuff:
Spoiler for Want your own HonestDownloads userbar?:
Hello! Do you want to show your affection for my website, HonestDownloads? Then here is a userbar I specially created earlier just for HonestDownloads users!

To add it to your signature just copy and paste the code below into your sig and you'll become an instant supporter of my website!

1
[URL=http://www.jhgenius01.webs.com][IMG]http://s1.bild.me/bilder/060112/3684792HDuserbaruser.png[/IMG][/URL]
Spoiler for My TI-nspire Basic Programs (Updated 2012/04/15):
***List of Programs in the TI-nspire Stadium***
Group Release 2012/04/07 on omnimaga.org

Games
   Noteable Release    ticalc.org Release Development/Not Publicly Released
2010/05/08 TI-nspire Hold 'em
   2012/04/07 v1.1.2   2012/04/10 v1.1.3  2012/04/14 v1.2.1
2010/08/03 Cosmic Legions
   2012/04/07 v0.2.2.2 (1st Release)
2010/08/12 Battle of 16s
   2012/04/07 v0.2.7
2010/09/10 Health Bar
   2012/04/07 v1.2     2012/04/02 v1.0   
2010/12/04 sTIck RPG
   2012/04/07 v0.1.5.2
2011/01/09 Monopoly
   2012/04/07 v0.16    (1st Release)
2012/04/09 Scissors Paper Rock
   2012/04/14 v0.8.1

Miscellaneous
2010/11/07 中文 (Chinese) Demonstration
   2012/04/07 v1.3     (1st Release)

Potential/Minor Programs
2010/09/26 Shanghai Metro
   2012/04/07 v0.2     (1st Release)
2010/12/22 TI-nspire Programming Tutorials
   2012/04/07 v0.1     (1st Release)
2010/12/28 Casino Games
   Was not released.
2011/04/22 Interlink
   2012/04/07 v0.0.4   (1st Release)
2012/03/22 Hierarchy
   2012/04/07 v0.01

Demo Programs (some may become Potential Programs)
2010/06/23 Monopoly (Board)
   2012/04/07 Prototype
2010/07/14 Strategy Battle
   2012/04/07 v0.12
2010/10/05 JRPG
   2012/04/07 v0.2
2010/11/02 PlotGrid
   2012/04/07 v0.2
2010/11/24 civilizaTIon™
   2012/04/07 v0.11

Purely Informational
2011/01/05 TI-nspire Stadium Changelog
   2012/04/07 v2
   Created to list significant releases of my programs. A page similar to this List of Programs in the TI-nspire Stadium was included in the documentation of most of my programs until sometime in Late 2011/Early 2012.

All games and programs coded in TI-nspire Basic.
© 2010-2012 Jason Ho.
Last Updated 14 April 2012

jhgenius01.webs.com
Will be moving! Stay tuned for updates.
Spoiler for Progress of Doodle God Axe:
2011/12/21 4% - Progress Suspended, ideas of graphical sprites still uncertain
Spoiler for Other Other You Know What Other Stuff I'm Talking About Stuff Stuff (Updated 2012/01/17):
Jonius7
aka jhgenius
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: 20 May, 2013, 06:58:52
Date Registered: 03 September, 2010, 02:50:11
Location: Gold Coast, Australia
Posts: 1743


Topic starter
Total Post Ratings: +50

View Profile WWW
« Reply #6 on: 10 September, 2012, 07:27:12 »
0

Jason's TI-nspire Hold 'em has reached 3000 downloads!
http://www.ticalc.org/archives/files/fileinfo/430/43059.html

I shall soon be uploading a 'master' plan for my intentions of taking this game to a whole new level.
« Last Edit: 10 September, 2012, 07:29:08 by Jonius7 » Logged



Userbars.com is down?
+9001
Intermediate TI-nspire Basic Programmer
Programmed some CASIO Basic in the past
DJ_O Music Discographist Wink
Userbars for these coming... in the process

My Released and Announced Projects (Updated 2013/01/29)
TI-nspire BASIC
TI-nspire Hold 'em | Health Bar | Scissors Paper Rock | Battle of 16s (stalled) | sTIck RPG (stalled) | Monopoly (stalled)

TI-nspire Lua
Numstrat | TI-nspire Hold 'em Lua | Terraria (coming soon)
Axe Parser
Doodle God (stalled while I go and learn some Axe)

Spoiler for Other Stuff:
Spoiler for Want your own HonestDownloads userbar?:
Hello! Do you want to show your affection for my website, HonestDownloads? Then here is a userbar I specially created earlier just for HonestDownloads users!

To add it to your signature just copy and paste the code below into your sig and you'll become an instant supporter of my website!

1
[URL=http://www.jhgenius01.webs.com][IMG]http://s1.bild.me/bilder/060112/3684792HDuserbaruser.png[/IMG][/URL]
Spoiler for My TI-nspire Basic Programs (Updated 2012/04/15):
***List of Programs in the TI-nspire Stadium***
Group Release 2012/04/07 on omnimaga.org

Games
   Noteable Release    ticalc.org Release Development/Not Publicly Released
2010/05/08 TI-nspire Hold 'em
   2012/04/07 v1.1.2   2012/04/10 v1.1.3  2012/04/14 v1.2.1
2010/08/03 Cosmic Legions
   2012/04/07 v0.2.2.2 (1st Release)
2010/08/12 Battle of 16s
   2012/04/07 v0.2.7
2010/09/10 Health Bar
   2012/04/07 v1.2     2012/04/02 v1.0   
2010/12/04 sTIck RPG
   2012/04/07 v0.1.5.2
2011/01/09 Monopoly
   2012/04/07 v0.16    (1st Release)
2012/04/09 Scissors Paper Rock
   2012/04/14 v0.8.1

Miscellaneous
2010/11/07 中文 (Chinese) Demonstration
   2012/04/07 v1.3     (1st Release)

Potential/Minor Programs
2010/09/26 Shanghai Metro
   2012/04/07 v0.2     (1st Release)
2010/12/22 TI-nspire Programming Tutorials
   2012/04/07 v0.1     (1st Release)
2010/12/28 Casino Games
   Was not released.
2011/04/22 Interlink
   2012/04/07 v0.0.4   (1st Release)
2012/03/22 Hierarchy
   2012/04/07 v0.01

Demo Programs (some may become Potential Programs)
2010/06/23 Monopoly (Board)
   2012/04/07 Prototype
2010/07/14 Strategy Battle
   2012/04/07 v0.12
2010/10/05 JRPG
   2012/04/07 v0.2
2010/11/02 PlotGrid
   2012/04/07 v0.2
2010/11/24 civilizaTIon™
   2012/04/07 v0.11

Purely Informational
2011/01/05 TI-nspire Stadium Changelog
   2012/04/07 v2
   Created to list significant releases of my programs. A page similar to this List of Programs in the TI-nspire Stadium was included in the documentation of most of my programs until sometime in Late 2011/Early 2012.

All games and programs coded in TI-nspire Basic.
© 2010-2012 Jason Ho.
Last Updated 14 April 2012

jhgenius01.webs.com
Will be moving! Stay tuned for updates.
Spoiler for Progress of Doodle God Axe:
2011/12/21 4% - Progress Suspended, ideas of graphical sprites still uncertain
Spoiler for Other Other You Know What Other Stuff I'm Talking About Stuff Stuff (Updated 2012/01/17):
AzNg0d1030
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: 19 May, 2013, 23:04:34
Date Registered: 26 October, 2011, 04:43:09
Location: Over the rainbow
Posts: 488


Total Post Ratings: +37

View Profile
« Reply #7 on: 10 September, 2012, 22:42:06 »
0

Jason's TI-nspire Hold 'em has reached 3000 downloads!
http://www.ticalc.org/archives/files/fileinfo/430/43059.html

I shall soon be uploading a 'master' plan for my intentions of taking this game to a whole new level.
Congrats and good job! (from customer)
Logged

What? WHAT? WHATTTT?Huh??

You just lost the game.

Suck it up.
blfngl
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: 08 May, 2013, 14:37:03
Date Registered: 29 August, 2012, 04:06:21
Location: Climbin' in yo windows...
Posts: 121


Total Post Ratings: -1

View Profile
« Reply #8 on: 11 September, 2012, 00:01:17 »
0

Ooooh I was gonna make that Angry but nice job! Grin
« Last Edit: 11 September, 2012, 00:01:28 by blfngl » Logged

GAMEGAMEGAMEGAMEGAMEGAMEGAMEGAMEGAMEGAME
My blog:

TiLibs
My Projects:
Minecraft Library
Jonius7
aka jhgenius
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: 20 May, 2013, 06:58:52
Date Registered: 03 September, 2010, 02:50:11
Location: Gold Coast, Australia
Posts: 1743


Topic starter
Total Post Ratings: +50

View Profile WWW
« Reply #9 on: 20 September, 2012, 05:53:01 »
0

As I said there is a poker dealer game out there already from Matt Oslan (it is the most downloaded TI-nspire Game on ticalc.org shocked) but I decided that it just wasn't good enough. Over time I have recoded pretty much every part of the program so it is my program now pretty much.

I need to get more familiar with Lua first, but here is a general progression plan (not restricted to language)

1. Determine what type of hand a player has.
This is quite an essential step in figuring out the poker hand rankings and where it stands. I have partially tried to do this and I have an idea (convert cards to number values in a matrix or list and compare values directly) More details later

2. Able to compare hands and determine the winner of a player
Previous point must be completed.

3. Begin a simple Computer AI that can compare hands and (possibly?) play for itself
After the program can determine poker hands, an AI can then be programmed in.

4. Add in more than 2 players
This will increase the complexity and I will have to reprogram some 2 player specific elements for this to work.

5. More complex AI
Details include better detection and prediction at whether others have good hands, when to fold (eg: fold if too many players are completing), when to bluff. Generally I have to know a lot about how to play the game myself in order to be able to have AN IDEA how to program it.

EDIT: I shall put this in the first post eventually...
« Last Edit: 09 October, 2012, 06:48:09 by Jonius7 » Logged



Userbars.com is down?
+9001
Intermediate TI-nspire Basic Programmer
Programmed some CASIO Basic in the past
DJ_O Music Discographist Wink
Userbars for these coming... in the process

My Released and Announced Projects (Updated 2013/01/29)
TI-nspire BASIC
TI-nspire Hold 'em | Health Bar | Scissors Paper Rock | Battle of 16s (stalled) | sTIck RPG (stalled) | Monopoly (stalled)

TI-nspire Lua
Numstrat | TI-nspire Hold 'em Lua | Terraria (coming soon)
Axe Parser
Doodle God (stalled while I go and learn some Axe)

Spoiler for Other Stuff:
Spoiler for Want your own HonestDownloads userbar?:
Hello! Do you want to show your affection for my website, HonestDownloads? Then here is a userbar I specially created earlier just for HonestDownloads users!

To add it to your signature just copy and paste the code below into your sig and you'll become an instant supporter of my website!

1
[URL=http://www.jhgenius01.webs.com][IMG]http://s1.bild.me/bilder/060112/3684792HDuserbaruser.png[/IMG][/URL]
Spoiler for My TI-nspire Basic Programs (Updated 2012/04/15):
***List of Programs in the TI-nspire Stadium***
Group Release 2012/04/07 on omnimaga.org

Games
   Noteable Release    ticalc.org Release Development/Not Publicly Released
2010/05/08 TI-nspire Hold 'em
   2012/04/07 v1.1.2   2012/04/10 v1.1.3  2012/04/14 v1.2.1
2010/08/03 Cosmic Legions
   2012/04/07 v0.2.2.2 (1st Release)
2010/08/12 Battle of 16s
   2012/04/07 v0.2.7
2010/09/10 Health Bar
   2012/04/07 v1.2     2012/04/02 v1.0   
2010/12/04 sTIck RPG
   2012/04/07 v0.1.5.2
2011/01/09 Monopoly
   2012/04/07 v0.16    (1st Release)
2012/04/09 Scissors Paper Rock
   2012/04/14 v0.8.1

Miscellaneous
2010/11/07 中文 (Chinese) Demonstration
   2012/04/07 v1.3     (1st Release)

Potential/Minor Programs
2010/09/26 Shanghai Metro
   2012/04/07 v0.2     (1st Release)
2010/12/22 TI-nspire Programming Tutorials
   2012/04/07 v0.1     (1st Release)
2010/12/28 Casino Games
   Was not released.
2011/04/22 Interlink
   2012/04/07 v0.0.4   (1st Release)
2012/03/22 Hierarchy
   2012/04/07 v0.01

Demo Programs (some may become Potential Programs)
2010/06/23 Monopoly (Board)
   2012/04/07 Prototype
2010/07/14 Strategy Battle
   2012/04/07 v0.12
2010/10/05 JRPG
   2012/04/07 v0.2
2010/11/02 PlotGrid
   2012/04/07 v0.2
2010/11/24 civilizaTIon™
   2012/04/07 v0.11

Purely Informational
2011/01/05 TI-nspire Stadium Changelog
   2012/04/07 v2
   Created to list significant releases of my programs. A page similar to this List of Programs in the TI-nspire Stadium was included in the documentation of most of my programs until sometime in Late 2011/Early 2012.

All games and programs coded in TI-nspire Basic.
© 2010-2012 Jason Ho.
Last Updated 14 April 2012

jhgenius01.webs.com
Will be moving! Stay tuned for updates.
Spoiler for Progress of Doodle God Axe:
2011/12/21 4% - Progress Suspended, ideas of graphical sprites still uncertain
Spoiler for Other Other You Know What Other Stuff I'm Talking About Stuff Stuff (Updated 2012/01/17):
Jonius7
aka jhgenius
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: 20 May, 2013, 06:58:52
Date Registered: 03 September, 2010, 02:50:11
Location: Gold Coast, Australia
Posts: 1743


Topic starter
Total Post Ratings: +50

View Profile WWW
« Reply #10 on: 09 October, 2012, 06:55:15 »
0

A few days (maybe a week) ago I went through TI-nspire Hold 'em and optimised and added some things. I was nearly going to call it v1.3 but currently it's v1.2.4. Most importantly, I fixed up the all-in bug where no matter what happens, one player loses all his/her chips and the game ends. Just deleting two lines of code where I had put 0 -> [variable] fixed it all up!

Putting this up on ticalc.org as soon as is reasonable for me to set this time aside.
http://www.ticalc.org/archives/files/fileinfo/430/43059.html

I've been thinking about a Lua version all the time, and I am still trying to think on how to progress on this. It will be slow progress but I also have limited time to keep to big picture of what I want the program to look like (clearly a much higher standard than the Basic version right now, [maybe I'm setting standards too high]), in order to stay focused.
« Last Edit: 12 October, 2012, 03:19:25 by Jonius7 » Logged



Userbars.com is down?
+9001
Intermediate TI-nspire Basic Programmer
Programmed some CASIO Basic in the past
DJ_O Music Discographist Wink
Userbars for these coming... in the process

My Released and Announced Projects (Updated 2013/01/29)
TI-nspire BASIC
TI-nspire Hold 'em | Health Bar | Scissors Paper Rock | Battle of 16s (stalled) | sTIck RPG (stalled) | Monopoly (stalled)

TI-nspire Lua
Numstrat | TI-nspire Hold 'em Lua | Terraria (coming soon)
Axe Parser
Doodle God (stalled while I go and learn some Axe)

Spoiler for Other Stuff:
Spoiler for Want your own HonestDownloads userbar?:
Hello! Do you want to show your affection for my website, HonestDownloads? Then here is a userbar I specially created earlier just for HonestDownloads users!

To add it to your signature just copy and paste the code below into your sig and you'll become an instant supporter of my website!

1
[URL=http://www.jhgenius01.webs.com][IMG]http://s1.bild.me/bilder/060112/3684792HDuserbaruser.png[/IMG][/URL]
Spoiler for My TI-nspire Basic Programs (Updated 2012/04/15):
***List of Programs in the TI-nspire Stadium***
Group Release 2012/04/07 on omnimaga.org

Games
   Noteable Release    ticalc.org Release Development/Not Publicly Released
2010/05/08 TI-nspire Hold 'em
   2012/04/07 v1.1.2   2012/04/10 v1.1.3  2012/04/14 v1.2.1
2010/08/03 Cosmic Legions
   2012/04/07 v0.2.2.2 (1st Release)
2010/08/12 Battle of 16s
   2012/04/07 v0.2.7
2010/09/10 Health Bar
   2012/04/07 v1.2     2012/04/02 v1.0   
2010/12/04 sTIck RPG
   2012/04/07 v0.1.5.2
2011/01/09 Monopoly
   2012/04/07 v0.16    (1st Release)
2012/04/09 Scissors Paper Rock
   2012/04/14 v0.8.1

Miscellaneous
2010/11/07 中文 (Chinese) Demonstration
   2012/04/07 v1.3     (1st Release)

Potential/Minor Programs
2010/09/26 Shanghai Metro
   2012/04/07 v0.2     (1st Release)
2010/12/22 TI-nspire Programming Tutorials
   2012/04/07 v0.1     (1st Release)
2010/12/28 Casino Games
   Was not released.
2011/04/22 Interlink
   2012/04/07 v0.0.4   (1st Release)
2012/03/22 Hierarchy
   2012/04/07 v0.01

Demo Programs (some may become Potential Programs)
2010/06/23 Monopoly (Board)
   2012/04/07 Prototype
2010/07/14 Strategy Battle
   2012/04/07 v0.12
2010/10/05 JRPG
   2012/04/07 v0.2
2010/11/02 PlotGrid
   2012/04/07 v0.2
2010/11/24 civilizaTIon™
   2012/04/07 v0.11

Purely Informational
2011/01/05 TI-nspire Stadium Changelog
   2012/04/07 v2
   Created to list significant releases of my programs. A page similar to this List of Programs in the TI-nspire Stadium was included in the documentation of most of my programs until sometime in Late 2011/Early 2012.

All games and programs coded in TI-nspire Basic.
© 2010-2012 Jason Ho.
Last Updated 14 April 2012

jhgenius01.webs.com
Will be moving! Stay tuned for updates.
Spoiler for Progress of Doodle God Axe:
2011/12/21 4% - Progress Suspended, ideas of graphical sprites still uncertain
Spoiler for Other Other You Know What Other Stuff I'm Talking About Stuff Stuff (Updated 2012/01/17):
Jonius7
aka jhgenius
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: 20 May, 2013, 06:58:52
Date Registered: 03 September, 2010, 02:50:11
Location: Gold Coast, Australia
Posts: 1743


Topic starter
Total Post Ratings: +50

View Profile WWW
« Reply #11 on: 11 October, 2012, 13:36:10 »
0

Ok I have an extremely incomplete, buggy and almost not working start to my Lua version of TI-nspire Hold 'em. I have used the How to have a nice "input" function in Lua on inspired-lua.org for input into changing number values. After fiddling around and running it heaps of times correcting nightmarish easy and both more challenging bugs, I find one that looks like I have to rewrite 25-30% of what I have currently again. The input function creates strings, I tried to compare these strings to a number, resulting an error on line 67. So for the "input" function, looks like I'll actually have to make it somehow a number that can be user-changed, displayed and compared to other numbers.

I also need to know how you can do algebra in Lua. Oh wait, in TI-nspire Basic if you typed 0.5x (x being a variable) it would automatically put in the multiply symbol in. Looks like I have to do that in Lua also (* symbol), any other handy ways?

I hope some of this made sense, I'll come back later with some clarification if necessary.
Here is the code so far:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
--[[TI-nspire Hold 'em - A Lua Remake
History:
v0.01 Created 2012/09/23 really started working 2012/10/07
Buggy can hardly do anything, currently can change Chips, Big Blind, Small Blind]]--

function init_variables()
cc=0
bb=0
sb=0
gopt=1
scrn=1
end

init_variables()

function on.paint(gc)
    gc:setFont("sansserif","r",10)
    gc:setColorRGB(0,0,0)
-- gc:setPen("thin","smooth")  Is this necessary?
if scrn==1 then
gc:drawString("[c] Chips        " .. cc,10,10,"top")
gc:drawString("[b] Big Blind    " .. bb,10,25,"top")
gc:drawString("[s] Small Blind  " .. sb,10,40,"top")
gc:drawRect(10,70,20,20)
elseif scrn==2 then
gc:drawString("Right let's get rolling!",10,10,"top")
end

end

function on.charIn(ch)
if ch >= "0" and ch <= "9" then    -- checking for digit inputs
if scrn==1 then
if gopt==1 then
if string.len(cc) <= 7 then   -- limit string length
cc = cc .. ch            -- concatenate
platform.window:invalidate()   -- screen refresh
end
elseif gopt==2 then
if string.len(bb) <= 6 then -- and sb <= 0.1bb then   -- limit string length and bb to <= 0.1cc (now moved)
bb = bb .. ch            -- concatenate
platform.window:invalidate()   -- screen refresh
end
elseif gopt==3 then
if string.len(sb) <= 6 then -- and sb <= 0.1bb then   -- limit string length and sb to <= 0.1bb (now moved)
sb = sb .. ch            -- concatenate
platform.window:invalidate()   -- screen refresh
end
end
end
end
--Game settings keys
if scrn==1 then
if ch=="c" then     --Ok there must be a way to optimise this block
gopt = 1   
elseif ch=="b" then
gopt = 2
elseif ch=="s" then
gopt = 3
end
platform.window:invalidate()
end
end

function on.enterKey()
if scrn==1 then
if cc >= 100 and cc <= 10000000 and bb >= 0.001*cc and bb <= 0.1*cc and sb >= 0.01*bb and sb <= 0.5*bb then
platform.gc():drawString("Congrats! Settings set up correctly",10,70,"top")
scrn=2
gopt=0
else
platform.gc():drawString("Check these conditions",10,70,"top")
platform.gc():drawString("Chips between 100 and 10 million",10,85,"top")
platform.gc():drawString("Big blind between 0.001 and 0.1 Chips",10,100,"top")
platform.gc():drawString("Small blind between 0.01 and 0.5 Big Blind",10,115,"top")
end
end
end

function on.backspaceKey()
if gopt==1 then     --Ok there must be a way to optimise this block. Again.
cc = string.usub(cc,0,-2)  -- deleting last char
    elseif gopt==2 then
bb = string.usub(bb,0,-2)  -- deleting last char
elseif gopt==3 then
sb = string.usub(sb,0,-2)  -- deleting last char
end
    platform.window:invalidate() 
end

platform.window:invalidate()

It's a first and slow step. I could also do well to learn from my other Lua project, Numstrat.

PS: This took at least 1.5 hours, maybe 2. OMG how can it take so long!!!
« Last Edit: 11 October, 2012, 13:37:14 by Jonius7 » Logged



Userbars.com is down?
+9001
Intermediate TI-nspire Basic Programmer
Programmed some CASIO Basic in the past
DJ_O Music Discographist Wink
Userbars for these coming... in the process

My Released and Announced Projects (Updated 2013/01/29)
TI-nspire BASIC
TI-nspire Hold 'em | Health Bar | Scissors Paper Rock | Battle of 16s (stalled) | sTIck RPG (stalled) | Monopoly (stalled)

TI-nspire Lua
Numstrat | TI-nspire Hold 'em Lua | Terraria (coming soon)
Axe Parser
Doodle God (stalled while I go and learn some Axe)

Spoiler for Other Stuff:
Spoiler for Want your own HonestDownloads userbar?:
Hello! Do you want to show your affection for my website, HonestDownloads? Then here is a userbar I specially created earlier just for HonestDownloads users!

To add it to your signature just copy and paste the code below into your sig and you'll become an instant supporter of my website!

1
[URL=http://www.jhgenius01.webs.com][IMG]http://s1.bild.me/bilder/060112/3684792HDuserbaruser.png[/IMG][/URL]
Spoiler for My TI-nspire Basic Programs (Updated 2012/04/15):
***List of Programs in the TI-nspire Stadium***
Group Release 2012/04/07 on omnimaga.org

Games
   Noteable Release    ticalc.org Release Development/Not Publicly Released
2010/05/08 TI-nspire Hold 'em
   2012/04/07 v1.1.2   2012/04/10 v1.1.3  2012/04/14 v1.2.1
2010/08/03 Cosmic Legions
   2012/04/07 v0.2.2.2 (1st Release)
2010/08/12 Battle of 16s
   2012/04/07 v0.2.7
2010/09/10 Health Bar
   2012/04/07 v1.2     2012/04/02 v1.0   
2010/12/04 sTIck RPG
   2012/04/07 v0.1.5.2
2011/01/09 Monopoly
   2012/04/07 v0.16    (1st Release)
2012/04/09 Scissors Paper Rock
   2012/04/14 v0.8.1

Miscellaneous
2010/11/07 中文 (Chinese) Demonstration
   2012/04/07 v1.3     (1st Release)

Potential/Minor Programs
2010/09/26 Shanghai Metro
   2012/04/07 v0.2     (1st Release)
2010/12/22 TI-nspire Programming Tutorials
   2012/04/07 v0.1     (1st Release)
2010/12/28 Casino Games
   Was not released.
2011/04/22 Interlink
   2012/04/07 v0.0.4   (1st Release)
2012/03/22 Hierarchy
   2012/04/07 v0.01

Demo Programs (some may become Potential Programs)
2010/06/23 Monopoly (Board)
   2012/04/07 Prototype
2010/07/14 Strategy Battle
   2012/04/07 v0.12
2010/10/05 JRPG
   2012/04/07 v0.2
2010/11/02 PlotGrid
   2012/04/07 v0.2
2010/11/24 civilizaTIon™
   2012/04/07 v0.11

Purely Informational
2011/01/05 TI-nspire Stadium Changelog
   2012/04/07 v2
   Created to list significant releases of my programs. A page similar to this List of Programs in the TI-nspire Stadium was included in the documentation of most of my programs until sometime in Late 2011/Early 2012.

All games and programs coded in TI-nspire Basic.
© 2010-2012 Jason Ho.
Last Updated 14 April 2012

jhgenius01.webs.com
Will be moving! Stay tuned for updates.
Spoiler for Progress of Doodle God Axe:
2011/12/21 4% - Progress Suspended, ideas of graphical sprites still uncertain
Spoiler for Other Other You Know What Other Stuff I'm Talking About Stuff Stuff (Updated 2012/01/17):
Jonius7
aka jhgenius
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: 20 May, 2013, 06:58:52
Date Registered: 03 September, 2010, 02:50:11
Location: Gold Coast, Australia
Posts: 1743


Topic starter
Total Post Ratings: +50

View Profile WWW
« Reply #12 on: 13 October, 2012, 11:26:06 »
0

No one? Maybe this'd be better suited in the Lua Language section.
Logged



Userbars.com is down?
+9001
Intermediate TI-nspire Basic Programmer
Programmed some CASIO Basic in the past
DJ_O Music Discographist Wink
Userbars for these coming... in the process

My Released and Announced Projects (Updated 2013/01/29)
TI-nspire BASIC
TI-nspire Hold 'em | Health Bar | Scissors Paper Rock | Battle of 16s (stalled) | sTIck RPG (stalled) | Monopoly (stalled)

TI-nspire Lua
Numstrat | TI-nspire Hold 'em Lua | Terraria (coming soon)
Axe Parser
Doodle God (stalled while I go and learn some Axe)

Spoiler for Other Stuff:
Spoiler for Want your own HonestDownloads userbar?:
Hello! Do you want to show your affection for my website, HonestDownloads? Then here is a userbar I specially created earlier just for HonestDownloads users!

To add it to your signature just copy and paste the code below into your sig and you'll become an instant supporter of my website!

1
[URL=http://www.jhgenius01.webs.com][IMG]http://s1.bild.me/bilder/060112/3684792HDuserbaruser.png[/IMG][/URL]
Spoiler for My TI-nspire Basic Programs (Updated 2012/04/15):
***List of Programs in the TI-nspire Stadium***
Group Release 2012/04/07 on omnimaga.org

Games
   Noteable Release    ticalc.org Release Development/Not Publicly Released
2010/05/08 TI-nspire Hold 'em
   2012/04/07 v1.1.2   2012/04/10 v1.1.3  2012/04/14 v1.2.1
2010/08/03 Cosmic Legions
   2012/04/07 v0.2.2.2 (1st Release)
2010/08/12 Battle of 16s
   2012/04/07 v0.2.7
2010/09/10 Health Bar
   2012/04/07 v1.2     2012/04/02 v1.0   
2010/12/04 sTIck RPG
   2012/04/07 v0.1.5.2
2011/01/09 Monopoly
   2012/04/07 v0.16    (1st Release)
2012/04/09 Scissors Paper Rock
   2012/04/14 v0.8.1

Miscellaneous
2010/11/07 中文 (Chinese) Demonstration
   2012/04/07 v1.3     (1st Release)

Potential/Minor Programs
2010/09/26 Shanghai Metro
   2012/04/07 v0.2     (1st Release)
2010/12/22 TI-nspire Programming Tutorials
   2012/04/07 v0.1     (1st Release)
2010/12/28 Casino Games
   Was not released.
2011/04/22 Interlink
   2012/04/07 v0.0.4   (1st Release)
2012/03/22 Hierarchy
   2012/04/07 v0.01

Demo Programs (some may become Potential Programs)
2010/06/23 Monopoly (Board)
   2012/04/07 Prototype
2010/07/14 Strategy Battle
   2012/04/07 v0.12
2010/10/05 JRPG
   2012/04/07 v0.2
2010/11/02 PlotGrid
   2012/04/07 v0.2
2010/11/24 civilizaTIon™
   2012/04/07 v0.11

Purely Informational
2011/01/05 TI-nspire Stadium Changelog
   2012/04/07 v2
   Created to list significant releases of my programs. A page similar to this List of Programs in the TI-nspire Stadium was included in the documentation of most of my programs until sometime in Late 2011/Early 2012.

All games and programs coded in TI-nspire Basic.
© 2010-2012 Jason Ho.
Last Updated 14 April 2012

jhgenius01.webs.com
Will be moving! Stay tuned for updates.
Spoiler for Progress of Doodle God Axe:
2011/12/21 4% - Progress Suspended, ideas of graphical sprites still uncertain
Spoiler for Other Other You Know What Other Stuff I'm Talking About Stuff Stuff (Updated 2012/01/17):
Rhombicuboctahedron
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Yesterday at 01:00:32
Date Registered: 11 October, 2012, 04:11:39
Location: Texas
Posts: 437


Total Post Ratings: +35

View Profile
« Reply #13 on: 13 October, 2012, 17:37:26 »
+1

Well, when I ran it with the script editor, pressing c, b and s works fine, as well as backspace and typing numbers, and not typing letters.
However, when I press enter, it just goes blank, instead of displaying congrats or the other four strings. I tried using some functions, such as var.recall or var.recallStr, that I thought should convert strings to values, like “0” to 0. That did not work.

In the end, I found the problem

plat form . gc ( )
Returns a dummy graphics context. It is typically used to measure pixel lengths and
heights of strings when a normal graphics context is not available. This may be the case
when creating new text elements when the script app is initialized. A graphics context
is available only during paint events, and that may be too late to create and size the
containers for text _elds.
This graphics context should not be used to draw graphics because it is not guaranteed to
be associated with a window.
Introduced in platform.apiLevel = "1.0"
Removed in platform.apiLevel = "2.0"

So, I was using level 2.0, and it also says not to use it for drawing graphics such as strings.
It may still work on OS 3.1, but if I’m not mistaken, I believe you changed to OS 3.2 in the OS compatibility post.
« Last Edit: 13 October, 2012, 17:37:54 by Rhombicuboctahedron » Logged

Rhombicuboctahedron
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Yesterday at 01:00:32
Date Registered: 11 October, 2012, 04:11:39
Location: Texas
Posts: 437


Total Post Ratings: +35

View Profile
« Reply #14 on: 13 October, 2012, 18:52:08 »
+1

Okay, I changed it a little to get it to work, but a big problem was that you were trying to compare a number and a string.
However, I noticed that if you multiply the string of a number by one, it makes it that number.
Also, I moved the congrats and correcting strings into the function on.paint(gc) section
My changes are probably w=quite ugly and inefficient, but it gets all the way to the “lets get rolling” string


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
--[[TI-nspire Hold 'em - A Lua Remake
History:
v0.01 Created 2012/09/23 really started working 2012/10/07
Buggy can hardly do anything, currently can change Chips, Big Blind, Small Blind]]--

function init_variables()
  cc=0
  bb=0
  sb=0
  gopt=1
  scrn=1
  message=""
end

init_variables()
 
 function on.paint(gc)
    gc:setFont("sansserif","r",10)
    gc:setColorRGB(0,0,0)
  -- gc:setPen("thin","smooth")  Is this necessary?
  if scrn==1 then
   gc:drawString("[c] Chips        " .. cc,10,10,"top")
   gc:drawString("[b] Big Blind    " .. bb,10,25,"top")
   gc:drawString("[s] Small Blind  " .. sb,10,40,"top")
   gc:drawRect(10,70,20,20)
   if message=="wrong" then
       gc:drawString("Check these conditions",10,70,"top")
    gc:drawString("Chips between 100 and 10 million",10,85,"top")
    gc:drawString("Big blind between 0.001 and 0.1 Chips",10,100,"top")
    gc:drawString("Small blind between 0.01 and 0.5 Big Blind",10,115,"top")
    end
  elseif scrn==3 then
   gc:drawString("Right let's get rolling!",10,10,"top")
  end
  if scrn==2 then
   if message=="congrats" then
    gc:drawString("Congrats! Settings set up correctly",10,70,"top")
   end
   end
 end

function on.charIn(ch)
  if ch >= "0" and ch <= "9" then    -- checking for digit inputs
   if scrn==1 then
    if gopt==1 then
     if string.len(cc) <= 7 then   -- limit string length
      cc = cc .. ch            -- concatenate
      platform.window:invalidate()   -- screen refresh
     end
    elseif gopt==2 then
     if string.len(bb) <= 6 then -- and sb <= 0.1bb then   -- limit string length and bb to <= 0.1cc (now moved)
      bb = bb .. ch            -- concatenate
      platform.window:invalidate()   -- screen refresh
     end
    elseif gopt==3 then
     if string.len(sb) <= 6 then -- and sb <= 0.1bb then   -- limit string length and sb to <= 0.1bb (now moved)
      sb = sb .. ch            -- concatenate
      platform.window:invalidate()   -- screen refresh
     end
    end
   end
  end
--Game settings keys
  if scrn==1 then
   if ch=="c" then     --Ok there must be a way to optimise this block
    gopt = 1   
  elseif ch=="b" then
    gopt = 2
   elseif ch=="s" then
    gopt = 3
   end
   platform.window:invalidate()
  end
end

function on.enterKey()
cc=1*cc
bb=1*bb
sb=1*sb
  if scrn==2 then
   scrn=3
  end
  if scrn==1 and cc >= 100 and cc <= 10000000 and bb >= 0.001*cc and bb <= 0.1*cc and sb >= 0.01*bb and sb <= 0.5*bb then
    message="congrats"
    scrn=2
    gopt=0
   else
    message="wrong"
   end
   
end

function on.backspaceKey()
  if gopt==1 then     --Ok there must be a way to optimise this block. Again.
   cc = string.usub(cc,0,-2)  -- deleting last char
    elseif gopt==2 then
   bb = string.usub(bb,0,-2)  -- deleting last char
 elseif gopt==3 then
   sb = string.usub(sb,0,-2)  -- deleting last char
 end
    platform.window:invalidate() 
end

platform.window:invalidate()
Logged

Pages: [1] 2   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.517 seconds with 31 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.