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.
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!
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.
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
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.
At certain times I had large imgSRCs loading on the screen, what I found is that you can cut down the time it takes to refresh the screen dramatically if you have it to where it draws the image, and then only refresh sections of the screen that are changing with the functions.
Now that I have the next week off and can just solely work on this project. I'll have a completely functioning RPG here probably by monday night to then begin tweaks and GUI customizations. There isn't much code thats left to be ported from the NspireBASIC code. When I have it to where combat at least works, I'll post the .tns file itself as I hit each version so I can also get some feedback on what works and what doesnt.
So, I've been hard at work porting all the code to Lua.
I get to a semi-stopping point, and pasted the code into the student software (after using the TI scripting tools) And when I past into a new page, it completely crashes the student software dead.
I even tried just commenting out the entire code and pasting it and it crashes. I loaded up an earlier version of the code and it pastes fine. So something I added since the last version is crashing the software even if its commented out.
If someone can glance through the code and find something that is likely the culprit, please let me know. I have some suspicions and I'm working on it, but I added hundreds of lines of code and restructured the entire source code since I last checked it on the Nspire software. Brother.
Considering I dont even know what you mean by scrolling, I'll just take your word for it. And Yes this is my first Nspire project. Which is also why I'm completely open for any and all opinions/recommendations about the code
Really impressive ! Maybe that you should add images...
Thanks! Images are in the works, As well as maybe some animated sprites but slowly animated so it doesn't kill the nspire.
Although the posted code doesn't reflect it, I also JUST finished changing the platform.window:invalidate's so they only refresh the parts of the screen that have changing attributes. I haven't really seen THAT much of a speed change compared to before, but as the program gets larger with more images I can imagine it being a bigger deal.
Instead of trying to re-invent the wheel, I talked to Superbany of Ti RPG 2, and I got permission to try to port his game into Lua. This is what I have got so far, I agree that having a timer refresh is dicey at best, so I made it just to where when anything changes from an event it updates.
Although I didn't know until just now you can refresh certain parts of the screen instead of all of it.
I actually DID use the wiki from inspired-lua actually to learn Lua for the Nspire. Its a great website.
--[[This is a port of TI RPG 2 v2.0 by Superbany Original code taken from TI RPG 2.tns (10/25/2011) with permission from Superbany. Ported into Lua by Ghezra V0.02b =Changed option selection appearance in main menu and races +Inventory screen, Spells screen added =No longer have timer refresh main game, only mainmenu and intro. V0.02 +Added savegame() and loadgame() completely +Endie() loaded completely +Added Escape Menu for in game saving, loading, quiting =Text optimization thus far V0.01b +Added Main Menu graphic +Finished converting showequip to equipment() +Added Equipment screen fully (e) V0.01a -Removed redundant functions no longer needed in Lua +Have character creation working while running on Nspire +Have HUD for player stats working V0.01 +Copied code into lua]] function on.timer() gameTime = gameTime + 1 if gameTime == 20 then gameTime = 0 end platform.window:invalidate() end function on.arrowUp() if mainMenu==1 then if mainChoice>1 then mainChoice=mainChoice-1 end end platform.window:invalidate() end function on.arrowDown() if mainMenu==1 then if mainChoice<2 then mainChoice=mainChoice+1 end end platform.window:invalidate() end function on.arrowRight() if init==0 then if initChoice<4 then initChoice=initChoice+1 end introduction() end platform.window:invalidate() end function on.arrowLeft() if init==0 then if initChoice>1 then initChoice=initChoice-1 end introduction() end platform.window:invalidate() end function on.charIn(char) if escMenu==1 then if char=="s" then savegame() escMsg="Game Successfully Saved" elseif char=="l" then loadgame() escMsg="Game Successfully Loaded" elseif char=="q" then on.create() end else if char=="e" and showEquip==0 then equipment() showEquip=1 else showEquip=0 end if char=="i" and showInventory==0 then showInventory=1 else showInventory=0 end if char=="m" and showMagic==0 then showMagic=1 else showMagic=0 end if char=="s" and showStatus==0 then showStatus=1 else showStatus=0 end
if place == "world" then if char == "1" then place = "forest" forest() elseif char == "2" then place = "town" town() elseif char == "3" then place = "castle" castle() end end
--Testing purposes *everything below line--- if char == "x" then xp = xp + 1 elseif char == "f" then endie() end -------------------------------------------- end platform.window:invalidate() end function on.enterKey()
if mainMenu == 1 then if mainChoice == 1 then introduction() mainMenu = 0 lineMain = "" elseif mainChoice == 2 then savetest = var.recall("savegame1") if savetest == nil then lineMain = "Not a valid option at this time." else mainMenu = 0 init = 1 loadgame() world() end end elseif mainMenu == 0 then if init == 0 then charCreation() timer.stop() end end platform.window:invalidate() end function on.escapeKey() if mainMenu == 0 and init == 1 then showEquip = 0 showInventory = 0 showMagic = 0 showStatus = 0 if escMenu == 0 then escMsg = "" escMenu = 1 else escMenu = 0 end end platform.window:invalidate() end function on.create() gameTime = 0 timer.start(1/20) initChoice = 1 showEquip = 0 mainChoice = 1 race = "Spirit" mainMenu = 1 init = 0 escMenu = 0 line1 = " " line2 = " " line3 = " " line4 = " " line5 = " " line6 = " " line7 = " " line8 = " " line9 = " " line10 = " " platform.window:invalidate() --what else would be good to do as the program initializes? end function introduction()
line1 = "Every story has a beginning." line2 = "Choose the race your character will be." line3 = "Each race has certain advantages." line4 = "(use arrow keys, then press enter)" line6 = "Human Elf Halfling Dwarf" if initChoice == 1 then line7 = "High Strength and HP" elseif initChoice == 2 then line7 = "High Magic and Speed" elseif initChoice == 3 then line7 = "High Speed and Dexterity" else line7 = "High Defense and Strength"
end platform.window:invalidate()
end function equipment() --Define strings for current equipment --Helmet descriptions if helm == 1 then curhelm = "Level 1 Leather Cap" elseif helm == 2 then curhelm = "Level 2 Iron Guard" elseif helm == 3 then curhelm = "Level 3 Mithril Helm" elseif helm == 4 then curhelm = "Level 4 Mage Helm" elseif helm == 5 then curhelm = "Level 5 3rd Age Helm" elseif helm == 6 then curhelm = "Level 6 Ultimate Visage" elseif helm == 7 then curhelm = "L3v31 7 L33t H31m" end --Armor descriptions if armor == 1 then curarmor = "Level 1 Leather Body" elseif armor == 2 then curarmor = "Level 2 Iron Mail" elseif armor == 3 then curarmor = "Level 3 Mithril Plate" elseif armor == 4 then curarmor = "Level 4 Enchanted Armor" elseif armor == 5 then curarmor = "Level 5 3rd Age Armor" elseif armor == 6 then curarmor = "Level 6 Champion's Plate" elseif armor == 7 then curarmor = "L3v31 7 L33t P1@t3" else curarmor = "What?" end --Sword descriptions if sword == 1 then cursword = "Level 1 Bronze Dagger" elseif sword == 2 then cursword = "Level 2 Iron Shortsword" elseif sword == 3 then cursword = "Level 3 Mithril Longsword" elseif sword == 4 then cursword = "Level 4 Godsword" elseif sword == 5 then cursword = "Level 5 3rd Age Greatsword" elseif sword == 6 then cursword = "Level 6 Great Broadsword" elseif sword == 7 then cursword = "L3v31 7 L33t D3s1r0Y3r" end --Shield descriptions if shield == 1 then curshield = "Level 1 Wooden Guard" elseif shield == 2 then curshield = "Level 2 Iron Buckler" elseif shield == 3 then curshield = "Level 3 Mithril Square Shield" elseif shield == 4 then curshield = "Level 4 Mirror Shield" elseif shield == 5 then curshield = "Level 5 3rd Age Heraldic Shield" elseif shield == 6 then curshield = "Level 6 Champion's Kiteshield" elseif shield == 7 then curshield = "L3v31 7 L33t D3f3?d?r" end --Robe descriptions if robe == 1 then currobe = "Level 1 Brown Robe" elseif robe == 2 then currobe = "Level 2 Grey Robe" elseif robe == 3 then currobe = "Level 3 Blue Robe" elseif robe == 4 then currobe = "Level 4 White Robe" elseif robe == 5 then currobe = "Level 5 Black Robe" elseif robe == 6 then currobe = "Level 6 Epic Robe" elseif robe == 7 then currobe = "L3v31 7 l33t r0b3" end --Shoes descriptions if shoes == 1 then curshoes = "Level 1 Leather Shoes" elseif shoes == 2 then curshoes = "Level 2 Iron Studded Boots" elseif shoes == 3 then curshoes = "Level 3 Mithril Studded Boots" elseif shoes == 4 then curshoes = "Level 4 Shoes of Light" elseif shoes == 5 then curshoes = "Level 5 3rd Age Runners" elseif shoes == 6 then curshoes = "Level 6 Boots of Lightness" elseif shoes == 7 then curshoes = "L3v31 7 L33t R?pp3rs" end --Ring descriptions if ring == 0 then curring = "None" else if ringsight == 2 then curring = "Ring of Sight" elseif ringfear == 2 then curring = "Ring of Fear" elseif ringtrain == 2 then curring = "Training Ring" elseif ringwealth == 2 then curring = "Ring of Wealth" elseif ringcure == 2 then curring = "Ring of Curing" elseif ringhealth == 2 then curring = "Ring of Health" elseif ringl33t == 2 then curring = "L33t R1ng" end end --Bow descriptions if bow == 1 then curbow = "None" elseif bow == 2 then curbow = "Level 2 Oak Shortbow" elseif bow == 3 then curbow = "Level 3 Maple Bow" elseif bow == 4 then curbow = "Level 4 Righteous Longbow" elseif bow == 5 then curbow = "Level 5 3rd Age Horn Bow" elseif bow == 6 then curbow = "Level 6 Champion's Bow" elseif bow == 7 then curbow = "L3v31 7 L33t b0W" end --Arrow descriptions if arrowtyp == "normal" then curarrows = "Normal" elseif arrowtyp == "fire" then curarrows = "Fire " elseif arrowtyp == "poison" then curarrows = "Poison " elseif arrowtyp == "ice" then curarrows = "Ice " elseif arrowtyp == "magic" then curarrows = "Magic ?" elseif arrowtyp == "light" then curarrows = "Light " else curarrows = "L33t " end end function endie() --[[This is the function that is called when a monster is beaten Although will most likely change depending on how combat is handled in the future.]] if entyp == 1 then battleline1 = "You defeated the imp!" elseif entyp == 2 then battleline1 = "You defeated the slime!" elseif entyp == 3 then battleline1 = "You defeated the goblin!" elseif entyp == 4 then battleline1 = "You defeated the giant spider!" elseif entyp == 5 then battleline1 = "You defeated the ghost!" elseif entyp == 6 then battleline1 = "You defeated the hill giant!" elseif entyp == 7 then battleline1 = "You defeated the shade!" elseif entyp == 8 then battleline1 = "You defeated the medusa!" elseif entyp == 9 then battleline1 = "You defeated the leviathan!" elseif entyp == 10 then battleline1 = "You defeated the greater demon!" boss1 = 1 elseif entyp == 11 then battleline1 = "You defeated the Great Dragon!" boss2 = 1 elseif entyp == 12 then battleline1 = "You defeated the Demonic Beast" boss3 = 1 elseif entyp == 13 then battleline1 = "You defeated the doppelganger!" elseif entyp == 14 then entyp = 15 enhpmax = 2500 enhp = enhpmax enmag = 70 enpys = 75 enspeed = 50 enfire = 1 envenom = 0 battleline1 = "You will always encounter Failure" --call fight function as these bosses string together elseif entyp == 15 then entyp = 16 enhpmax = 5000 enhp = enhpmax enpys = 140 enmag = 100 enspeed = 80 envenom = 1 enfire = 0 battleline1 = "You cannot best Death" --call fight function as these bosses string together elseif entyp == 16 then entyp = 17 enhp = 25000 enhpmax = 25000 enpys = 175 enmag = 150 enspeed = 85 envenom = 0 enfire = 1 battleline1 = "You cannot face the Wrath!" --call fight function as these bosses string together elseif entyp == 17 then battleline1 = "You have defeated the Programmer's Wrath! A WINNER IS YOU!" boss4 = 1 hpmax = 100 bag = 100 strength = 100 + strboost defence = 100 + defboost speed = 100 + speboost dexterity = 100 + dexboost intelligence = 100 + intboost mpmax = 100 --End game with Win! end --Testing purposes -- if enxp == nil then enxp = 5 end ---------------------
local itemdrop = math.random(0,day+20) if itemdrop < day then local get = math.random(1,11) if get == 1 and bomb<bag then bomb = bomb+1 elseif get == 2 and poisdag < bag then poisdag = poisdag+1 elseif get == 3 and lamp < bag then lamp = lamp+1 elseif get == 4 and molotov < bag then molotov = molotov+1 elseif get == 5 and defpotion < bag then defpotion = defpotion+1 elseif get == 6 and spepotion < bag then spepotion = spepotion+1 elseif get == 7 and strpotion < bag then strpotion = strpotion+1 elseif get == 8 and intpotion < bag then intpotion = intpotion+1 elseif get == 9 and mppotion < bag then mppotion = mppotion+1 elseif get == 10 and hppotion < bag then hppotion = hppotion+1 elseif get == 11 and dexpotion < bag then dexpotion = dexpotion+1 end end gold = gold + math.random(1,round(((enxp*3)/2))) if ringwealth == 2 or ringl33t == 2 then gold = gold + math.random(1,enxp) end if gold > bag^(2) then gold = bag^(2) end if level < 100 then xp = xp + enxp if ringtrain == 2 or ringl33t == 2 then xp = xp+math.random(1,enxp) end end while xp > level^(2) and level<100 do points = points + 4 level = level + 1 --Disp "Level Up!" if level == 5 and skillrun == 0 then skillrun = 1 --Disp "You learned the skill ""run""!Now you can flee from battle" end if level == 10 and skillscan == 0 then skillscan = 1 --Disp "You learned the skill ""scan""!Now you can scan the enemy's stats" end if level == 15 and skillretreat == 0 then skillretreat = 1 --Disp "You learned the skill ""retreat""!Now you can increase the enemy's distance" end if level == 10 then --Disp "You can now use level 2 Iron equipment!" elseif level == 20 then --Disp "You can now use level 3 Mithril equipment!" elseif level == 30 then --Disp "You can now use level 4 Holy equipment!" elseif level == 40 then --Disp "You can now use level 5 3rd Age equipment!" elseif level == 50 then --Disp "You can now use level 6 Champion's equipment!" elseif level == 100 then --Disp "--Max Level Reached!--" xp = 10000 end end enburn = 0 enpois = 0 enlife = 0 stun = 0 end function savegame() --Current savegame process. Split up because the Nspire losses variables after 14 entries-- local saveGame1 = {race,arrows,arrowtyp,bag,bankgold,bomb,bow,boss1,boss2,boss3,boss4,burn,day,defboost} local saveGame2 = {defense,defpotion,dexboost,dexpotion,dexterity,distance,enburn,enlife,enpois,game,gold,gotboss1,gotboss2,gotboss3} local saveGame3 = {gotboss4,helm,herb,hp,hpmax,hppotion,intboost,intelligence,intpotion,lamp,level,molotov,mp,mpmax} local saveGame4 = {mppotion,orb,points,poisdag,pois,ring,ringcure,ringfear,ringhealth,ringl33t,ringsight,ringtrain,ringwealth,robe} local saveGame5 = {shield,shoes,skillretreat,skillrun,skillscan,speboost,special,speed,spellbolt,spellheal,spellstat,spellstun,spepotion} local saveGame6 = {strboost,strength,strpotion,stun,sword,xp,armor}
var.store("savegame1", saveGame1) var.store("savegame2", saveGame2) var.store("savegame3", saveGame3) var.store("savegame4", saveGame4) var.store("savegame5", saveGame5) var.store("savegame6", saveGame6) --Scan is already a table, so its just saved as a table var.store("savegame7", scan) end function loadgame() gameload1 = var.recall("savegame1") gameload2 = var.recall("savegame2") gameload3 = var.recall("savegame3") gameload4 = var.recall("savegame4") gameload5 = var.recall("savegame5") gameload6 = var.recall("savegame6")
if gameload1 == nil then --Then there is no save game and it displays as such else race = gameload1[1] armor = gameload6[7] arrows = gameload1[2] arrowtyp = gameload1[3] bag = gameload1[4] bankgold= gameload1[5] bomb= gameload1[6] bow= gameload1[7] boss1= gameload1[8] boss2= gameload1[9] boss3= gameload1[10] boss4= gameload1[11] burn= gameload1[12] day= gameload1[13] defboost= gameload1[14] defence= gameload2[1] defpotion= gameload2[2] dexboost= gameload2[3] dexpotion= gameload2[4] dexterity= gameload2[5] distance= gameload2[6] enburn= gameload2[7] enlife= gameload2[8] enpois= gameload2[9] game= gameload2[10] gold= gameload2[11] gotboss1= gameload2[12] gotboss2= gameload2[13] gotboss3= gameload2[14] gotboss4= gameload3[1] helm= gameload3[2] herb= gameload3[3] hp= gameload3[4] hpmax= gameload3[5] hppotion= gameload3[6] intboost= gameload3[7] intelligence= gameload3[8] intpotion= gameload3[9] lamp= gameload3[10] level= gameload3[11] molotov= gameload3[12] mp= gameload3[13] mpmax= gameload3[14] mppotion= gameload4[1] orb= gameload4[2] points= gameload4[3] poisdag= gameload4[4] pois= gameload4[5] ring= gameload4[6] ringcure= gameload4[7] ringfear= gameload4[8] ringhealth= gameload4[9] ringl33t= gameload4[10] ringsight= gameload4[11] ringtrain= gameload4[12] ringwealth= gameload4[13] robe= gameload4[14] scan= var.recall("savegame7") shield= gameload5[1] shoes= gameload5[2] skillretreat= gameload5[3] skillrun= gameload5[4] skillscan= gameload5[5] speboost= gameload5[6] special= gameload5[7] speed= gameload5[8] spellbolt= gameload5[9] spellheal= gameload5[10] spellstat= gameload5[11] spellstun= gameload5[12] spepotion= gameload5[13] strboost= gameload6[1] strength= gameload6[2] strpotion= gameload6[3] stun= gameload6[4] sword= gameload6[5] xp= gameload6[6] end end function world() line1 = "The forest is close and filled with monsters," line2 = "but the Town is behind you circling a hill." line3 = "On the hill is the Castle, overseeing everything." line4 = "What would you like to do?" line5 = "1) Into the forest." line6 = "2) Enter the town." line7 = "3) Go to the castle." place = "world" end function charCreation() --init = 0 for the time the enterkey and arrow keys modify just the race selection if initChoice == 1 then race = "Human"
init = 1 equipment() world() platform.window:invalidate() end function on.paint(gc) --Define the height and width of the screen to be used the rest of on.paint local h=platform.window:height() local w=platform.window:width() --Sets font and color gc:setFont("sansserif", "b", 10) gc:setColorRGB(0, 0, 0) --shm and swm to be used when mainMenu ~= 1 local shm = gc:getStringHeight(line1) local swm = gc:getStringWidth(line1)
if mainMenu == 1 then ---To draw the Banner into a variable once, and then uses what already was put into memory--- if mainbanner == nil then imgSRC_Main = "*banner image code here*" mainbanner = image.new(imgSRC_Main) end gc:drawImage(mainbanner, 60, 2)
---Setting up optiong for main menu--- gc:setFont("serif", "b", 10) gc:setColorRGB(0, 0, 0) local ng = "New Game" local mmh = gc:getStringHeight(ng) local mmw = gc:getStringWidth(ng) local ngw = (w/2-(gc:getStringWidth(ng))/2) gc:drawString(ng,ngw, 140)
--This calls to the savegame variable on the TInspire, if empty, then it makes load game italicized. savetest = var.recall("savegame1") if savetest == nil then gc:setFont("serif", "i", 10) gc:setColorRGB(50,50,50) gc:drawString("Load Game",ngw, 160) gc:setColorRGB(0,0,0) gc:setFont("serif", "b", 10) else gc:drawString("Load Game",ngw, 160) end
--This is the line at the bottom of the Main Menu screen if lineMain == nil then lineMain = " " --makes sure the next line has something to print, otherwise error of printing 'nil' end gc:drawString(lineMain, w/2-(gc:getStringWidth(lineMain))/2, 190)
--Defines the boxes that go around the choices for the Main Menu local blah = 0 if mainChoice == 1 then blah = 124 elseif mainChoice == 2 then blah = 143 end gc:drawArc(ngw- 7, blah, mmw+15, mmh+2,gameTime*18,105) gc:drawArc(ngw- 7, blah, mmw+15, mmh+2,180 + gameTime*18,105)
--Setting up General layout of text gc:drawString(line1, (w-62)/2-(gc:getStringWidth(line1))/2, 20) gc:drawString(line2, (w-62)/2-(gc:getStringWidth(line2))/2, 20+shm) gc:drawString(line3, (w-62)/2-(gc:getStringWidth(line3))/2, 20+2*shm) gc:drawString(line4, (w-62)/2-(gc:getStringWidth(line4))/2, 20+3*shm) gc:drawString(line5, (w-62)/2-(gc:getStringWidth(line5))/2, 20+4*shm) gc:drawString(line6, (w-62)/2-(gc:getStringWidth(line6))/2, 20+5*shm) gc:drawString(line7, (w-62)/2-(gc:getStringWidth(line7))/2, 20+6*shm) gc:drawString(line8, (w-62)/2-(gc:getStringWidth(line8))/2, 20+7*shm) gc:drawString(line9, (w-62)/2-(gc:getStringWidth(line9))/2, 20+8*shm) gc:drawString(line10, (w-62)/2-(gc:getStringWidth(line10))/2, 20+9*shm)
gc:drawString("Days left - "..(100-day), (w-62)/2-(gc:getStringWidth("Days left - ##"))/2, 20+10*shm)
--[[ Placeholder for if place == "world" then if img == nil then imgSRC = " *image source here* " img = image.new(imgSRC) end gc:drawImage(img, 115, 80) --end ]] --setting up general layout of Stats, only after stats have been determined gc:setFont("sansserif", "b", 8) gc:setColorRGB(0, 0, 0) local shs = gc:getStringHeight("HP") local swrace = gc:getStringWidth(race) gc:drawString(race, (w-32-round(swrace/2)), 20) gc:drawString("HP ", w-60, 20+shs) gc:drawString("MP ", w-60, 20+2*shs) gc:drawString("LVL ", w-60, 20+3*shs) gc:drawString("STR ", w-60, 20+4*shs) gc:drawString("DEX ", w-60, 20+5*shs) gc:drawString("INT ", w-60, 20+6*shs) gc:drawString("XP ", w-60, 20+7*shs) gc:drawString("Gold", w-60, 20+8*shs) gc:drawString(hp.."/"..hpmax, w-35, 20+shs) gc:drawString(mp.."/"..mpmax, w-35, 20+2*shs) gc:drawString(level, w-35, 20+3*shs) gc:drawString(strength, w-35, 20+4*shs) gc:drawString(dexterity, w-35, 20+5*shs) gc:drawString(intelligence, w-35, 20+6*shs) local xplength = gc:getStringWidth(xp.."/"..(level^(2)+1)) gc:drawString(xp.."/"..(level^(2)+1), (w-24)-round(xplength/2), 20+7*shs) gc:drawString(gold, w-35, 20+8*shs) gc:drawRect(w-62, 20-shs, 60, 9*shs+5) gc:drawString("E-Equip", w-60, 20+10*shs) gc:drawString("I-Inventory", w-60, 20+11*shs) gc:drawString("M-Magic", w-60, 20+12*shs) gc:drawString("S-Status", w-60, 20+13*shs)
if escMenu == 1 then gc:fillRect(w/2-100, h/2-75, 200, 150) gc:setColorRGB(220,220,220) gc:fillRect(w/2-98, h/2-73, 196, 146) gc:setColorRGB(0,0,0) local she = gc:getStringHeight("Test") if escMsg == nil then escMsg = "" end gc:setFont("serif", "b", 12)
gc:drawString("Game Menu", w/2-(gc:getStringWidth("Equipment"))/2,h/2-70+she) gc:setFont("sansserif", "b", 8) gc:drawString(escMsg, w/2-85, h/2-70+she*2) gc:drawString("Press ESC again to resume game", w/2-85, h/2-70+she*3) gc:drawString("S - Save Game", w/2-85, h/2-70+she*5) gc:drawString("L - Load Game", w/2-85, h/2-70+she*7) gc:drawString("Q - Quit to Main Menu", w/2-85, h/2-70+she*9) end if showEquip == 1 then equipment() gc:fillRect(w/2-100, h/2-75, 200, 150) gc:setColorRGB(220,220,220) gc:fillRect(w/2-98, h/2-73, 196, 146) gc:setColorRGB(0,0,0) local she = gc:getStringHeight("Test")
gc:setFont("sansserif", "b", 8) gc:drawString("Intelligence: "..intelligence, w/2-85, h/2-70+shsp*2) gc:drawString("Mana Power: "..mp.."/"..mpmax, w/2-85, h/2-70+shsp*3) gc:drawString("Bolt Level "..spellbolt, w/2-85, h/2-70+shsp*5) if spellheal == 0 then gc:drawString("-------", w/2-85, h/2-70+shsp*6) else gc:drawString("Heal Level "..spellheal, w/2-85, h/2-70+shsp*6) end if spellstat == 0 then gc:drawString("-------", w/2-85, h/2-70+shsp*7) else gc:drawString("Boost Level "..spellstat, w/2-85, h/2-70+shsp*7) end if spellstun == 0 then gc:drawString("-------", w/2-85, h/2-70+shsp*8) else gc:drawString("Stun Level "..spellstun, w/2-85, h/2-70+shsp*8) end
end end end function round(num, idp) local mult=10^(idp or 0) return math.floor(num*mult+0.5)/mult end function town() line1 = "The town is bustling with people." line2 = "There is a item shop to the left," line3 = "and a equipment store to the right." line4 = "Townspeople are huddled in many" line5 = "groups conversing." line6 = "What would you like to do?" line7 = "1) visit Item Shop" line8 = "2) visit Equipment Store" line9 = "3) Talk to random townspeople" end
I added a screen shot, which pretty much shows everything that's available/working right now.
Before I solidify the storyline, I wanted to iron out some of the logistics on getting some of the mechanics to work; Or, What I am ABLE to do, will dictate what I WILL do. lol in simpler terms.
And as for the placement of this thread, I put it in the Lua Programming section because the biggest thing I need at the moment, is pointers on my current Lua code to see if there are better ways at doing some of the things I am doing. I address most of my concerns/wants in comments through the code itself. But when I get a bit farther in development I'll look to the project section for help. Thanks again!
----------------------- Update: Newest version is runnable. 0.06 3/18/2012.
***.tns file not uploaded until I can have more time testing stability, next version I'll include the tns***
Basic Item Store added (ring shop and arrow shop coming in next update) Items can be used in combat now (poison daggers, bombs, molotovs, lamps, etc) Status effects work on players and enemies alike now General bug-fixing previous code (removing of loadstring in favor of _G, and many more)
Next 3 on list to finish: -Finishing bug fixing Item use in combat (some have slipped through) -Arrow type store and Ring store/implementing Rings -Re-vamping introduction to game -----------------------
Known bugs: (oh noes!) -Molotov,lamp, bomb hasn't been tested thoroughly enough