Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
20 May, 2013, 19:44:29 *
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 [3] 4 5 6   Go Down
  Print  
Author Topic: Ti RPG 2 done in Lua (V0.06) -  (Read 4195 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
Ghezra
LV2 Member (Next: 40)
**
Offline Offline

Last Login: 08 June, 2012, 20:06:19
Date Registered: 24 October, 2011, 02:46:50
Posts: 30

Topic starter
Total Post Ratings: +4

View Profile
« Reply #30 on: 06 March, 2012, 00:47:59 »
+1

In the code I give him credit, but I know what you mean about showing more direct credit in the game. It IS his game, and even though I am doing all the work with the lua with his permission, it is all based on his mechanics. He made a great game considering the massive limitations of the Nspire Basic, and I am in awe still as I would have given up with the prgm defines and deconstructs he does all through the game.

In other other news, I was slightly way-laid, so the playable version of the lua code wont be until tomorrow. (Although I doubt there was a line waiting for it to release, I will still do my best to have it come out relatively soon) Thanks for the interest! But what I would like too is if there are better ways of doing the certain things I am doing. My code is always available on the host-post. I know time is valuable though. Have a great monday everyone!



OH, and what is a way through Lua and the Nspire that you can prompt for user input and get it in as a string.. I'll be looking through lua-inspired as well.
« Last Edit: 06 March, 2012, 00:52:36 by Ghezra » Logged
cyanophycean314
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: 03 May, 2013, 19:28:34
Date Registered: 07 December, 2011, 02:44:32
Location: Somewhere?
Posts: 363


Total Post Ratings: +42

View Profile
« Reply #31 on: 06 March, 2012, 02:38:54 »
0

You'll find that right here: http://www.inspired-lua.org/2011/12/how-to-have-a-nice-little-input-function-in-lua/
Logged

Ghezra
LV2 Member (Next: 40)
**
Offline Offline

Last Login: 08 June, 2012, 20:06:19
Date Registered: 24 October, 2011, 02:46:50
Posts: 30

Topic starter
Total Post Ratings: +4

View Profile
« Reply #32 on: 06 March, 2012, 02:40:58 »
0

Nevermind (for now anyways) I ended up using a combination of on.char and on.enter to expand the banking system. It works now.. more or less. Although I can imagine there are definitely better ways of doing it.

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
function on.charIn(char)
     ....
     elseif place == "bank" then
if char=="0" or char=="1" or char=="2"or char=="3"or char=="4"or char=="5"or char=="6"or char=="7"or char=="8"or char=="9" then
if transaction == 0 then
transaction = char + 0
else
transaction = transaction..char
end
elseif char == "-" then
banktype = -1
                        line6 = "Withdraw : "..transaction
elseif char == "+" then
banktype = 1
                        line6 = "Deposit : "..transaction
end
     end
     ....
end
function on.enterKey()
     ....
     elseif place == "bank" then
if transaction ~= 0 and transaction ~= nil then
money = 0 + transaction
if bankgold >= -1*money and money <= gold then
bankgold = bankgold + (banktype*money)
gold = gold - (banktype*money)
end
line2 = "Balance : "..bankgold
transaction = 0
end
     end
     ....
end
Logged
cyanophycean314
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: 03 May, 2013, 19:28:34
Date Registered: 07 December, 2011, 02:44:32
Location: Somewhere?
Posts: 363


Total Post Ratings: +42

View Profile
« Reply #33 on: 06 March, 2012, 03:05:39 »
0

Quote
if char=="0" or char=="1" or char=="2"or char=="3"or char=="4"or char=="5"or char=="6"or char=="7"or char=="8"or char=="9" then

in python, it would just be "if char in {"1","2","3","4","5","6","7","8","9","0"}" I haven't really figured out a good way to shorten this either.
Logged

Ghezra
LV2 Member (Next: 40)
**
Offline Offline

Last Login: 08 June, 2012, 20:06:19
Date Registered: 24 October, 2011, 02:46:50
Posts: 30

Topic starter
Total Post Ratings: +4

View Profile
« Reply #34 on: 06 March, 2012, 05:09:09 »
0

Combat is coming along faster than I thought.

Here's a simple teaser... Smiley Scrolling combat text... graphical HP bars?!...
Spoiler for Hidden:

Logged
Jonius7
aka jhgenius
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

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


Total Post Ratings: +50

View Profile WWW
« Reply #35 on: 06 March, 2012, 11:59:37 »
0

Wow I like the graphical health bar and stats along the right. Definitely improving on the Basic version.
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):
Levak
LV8 Addict (Next: 1000)
********
Offline Offline

Gender: Male
Last Login: Today at 18:06:57
Date Registered: 04 April, 2010, 23:42:49
Location: France
Posts: 833


Total Post Ratings: +148

View Profile WWW
« Reply #36 on: 06 March, 2012, 12:13:46 »
+1

Quote
if char=="0" or char=="1" or char=="2"or char=="3"or char=="4"or char=="5"or char=="6"or char=="7"or char=="8"or char=="9" then

in python, it would just be "if char in {"1","2","3","4","5","6","7","8","9","0"}" I haven't really figured out a good way to shorten this either.

if char >= "0" and char <= "9" then

kthxbye

end
« Last Edit: 06 March, 2012, 12:14:47 by Levak » Logged

Human always wants to survive and that's why he will fall one day.
My website - TI-Planet - iNspired-Lua
Jonius7
aka jhgenius
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

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


Total Post Ratings: +50

View Profile WWW
« Reply #37 on: 06 March, 2012, 13:06:09 »
0

Of course, so simple, Levak, I didn't get the opportunity to look at that properly and post about that.
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):
Ghezra
LV2 Member (Next: 40)
**
Offline Offline

Last Login: 08 June, 2012, 20:06:19
Date Registered: 24 October, 2011, 02:46:50
Posts: 30

Topic starter
Total Post Ratings: +4

View Profile
« Reply #38 on: 07 March, 2012, 02:39:29 »
0

Thanks Levak!!

Updated the code and completed combat enough to where its possible to fight, level up, and die. Save and load work.

If you encounter any major issues, post here (I'm sure I know of them, because obviously the code isn't done yet.) but at least it will focus me into fixing those bugs first.

I uploaded the .tns of the newest version V0.04, so check it out! Suggestions always welcome!
Logged
cyanophycean314
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: 03 May, 2013, 19:28:34
Date Registered: 07 December, 2011, 02:44:32
Location: Somewhere?
Posts: 363


Total Post Ratings: +42

View Profile
« Reply #39 on: 07 March, 2012, 02:52:28 »
0

Oh yeah... That is good way, forgot about alphabetical comparison of strings. Tongue
Logged

Jonius7
aka jhgenius
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

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


Total Post Ratings: +50

View Profile WWW
« Reply #40 on: 07 March, 2012, 12:31:46 »
0

Nice! Some of the options don't work yet of course, but what you have so far definitely reflects on superbany's version while bringing in the advantages of Lua at the same time!
Also, there's a bug when I try to upgrade my defence, looks like you've spelled defence "defense".

I'll try and look for other bugs in your source code too. I am also trying to learn Lua at the moment, so this could help.
EDIT: Lol, Now the document is stuck at the error page, not sure how to return to the game.


* TIRPG2Lua Bug..PNG (7.07 KB, 336x243 - viewed 84 times.)
« Last Edit: 07 March, 2012, 12:41: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):
Ghezra
LV2 Member (Next: 40)
**
Offline Offline

Last Login: 08 June, 2012, 20:06:19
Date Registered: 24 October, 2011, 02:46:50
Posts: 30

Topic starter
Total Post Ratings: +4

View Profile
« Reply #41 on: 07 March, 2012, 16:09:21 »
0

If there is a lua code problem, the only way to return is to reload it from the computer. (Or you can try exiting out of that document without saving and reloading it.)

I'll have a fixed version with another 1-2 features implemented out in a few hours.
Logged
Ghezra
LV2 Member (Next: 40)
**
Offline Offline

Last Login: 08 June, 2012, 20:06:19
Date Registered: 24 October, 2011, 02:46:50
Posts: 30

Topic starter
Total Post Ratings: +4

View Profile
« Reply #42 on: 07 March, 2012, 18:54:11 »
0

Updated original post.

V0.04a
-Fixed Defence bug
-Added Inn
-Added Town conversations
-Days now cycle with Inn stays and not with combat
-Money in the bank gets interest per Inn stay now
Logged
someone
LV3 Member (Next: 100)
***
Offline Offline

Gender: Male
Last Login: Today at 17:43:11
Date Registered: 12 January, 2012, 19:07:23
Posts: 48


Total Post Ratings: +9

View Profile
« Reply #43 on: 07 March, 2012, 21:11:33 »
+1

Nice to see there's activity again in this game Smiley

I see that there is no color, I guess that was just something I was modifying Tongue (changed the text to have a blue color instead of black...)

Also noticed that you don't use arrays, I highly recommend you to change the variables you use for the strings into arrays of strings. It should help a lot reducing the amount of code you have. Well, you should really use it when you have variables like foo1, foo2, etc. that are related each other...

For example:
Instead of talkLine1, talkLine2, etc., you can create a variable talkLine = {} and then call them like this talkLine[1], talkLine[2], etc.

Here's a code example, so that you can see it easier:

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
function on.create()
    initChoice  = 1
    showEquip   = 0
    showUp      = 0
    mainChoice  = 1
    magicSelect = 0
    race        = "Spirit"
    mainMenu    = 1
    init        = 0
    escMenu     = 0
    
    line = {}
    for i=1, 10 do
        line[i] = ""
    end

    castleLine = {}
    for i=1, 4 do
        castleLine[i] = ""
    end

    townLine = {}
    for i=1, 10 do
        townLine[i] = ""
    end

    combatLine = {}
    for i=1,8 do
        combatLine[i] = ""
    end

    upLine = {}
    for i=1, 8 do
        upLine[i] = ""
    end

    talkLine = {}
    for i=1,5 do
        talkLine[i] = ""
    end
    
    platform.window:invalidate()
    --what else would be good to do as the program initializes?
end

function on.paint(gc)
    ...
    for i=1,#talkLine do
        gc:drawString(talkLine[i], 5, 20+shm*(i-1))
    end
    ...
« Last Edit: 07 March, 2012, 21:52:06 by someone » Logged
Ghezra
LV2 Member (Next: 40)
**
Offline Offline

Last Login: 08 June, 2012, 20:06:19
Date Registered: 24 October, 2011, 02:46:50
Posts: 30

Topic starter
Total Post Ratings: +4

View Profile
« Reply #44 on: 07 March, 2012, 23:53:31 »
0

Someone, that's a great suggestion! I'm unfamiliar with arrays, so I coded to my strengths but it would definitely help with cleaning up some of the code. I'll have to work a little bit to try to implement it soon after I get some more features ironed out.

Color is something that I'd love to do, but I was suggested to hash out all the feature/mechanics first and then work in the color afterwards. Based on how everything is drawn in on.paint() I can easily see how I can work in colors once I do get to that point. I personally only have a black and white Nspire (not the blue face one).

I also plan on adding sprites everywhere too. Not just the mainbanner as it is now. But I want to make sure that ALL Nspires have a good experience, instead of catering to CX's.

Keep the coding suggestions coming!
Logged
Pages: 1 2 [3] 4 5 6   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.326 seconds with 30 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.