0 Members and 2 Guests are viewing this topic.
Is it possible to be played on Nspire CX?
Quote from: DualBLDR on November 01, 2011, 05:12:52 pmIs it possible to be played on Nspire CX?Lua is only for CX or OS>3
Its very easy, you just have to think a bit how you implement it so that it doesn't run as slow as a snail
--[[This is a port of TI RPG 2 v2.0 by SuperbanyOriginal code taken from TI RPG 2.tns (10/25/2011)with permission from Superbany.Ported into Lua by GhezraV0.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 farV0.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 workingV0.01 +Copied code into lua]]function on.timer() gameTime = gameTime + 1 if gameTime == 20 then gameTime = 0 end platform.window:invalidate()endfunction on.arrowUp() if mainMenu==1 then if mainChoice>1 then mainChoice=mainChoice-1 end end platform.window:invalidate()endfunction on.arrowDown() if mainMenu==1 then if mainChoice<2 then mainChoice=mainChoice+1 end end platform.window:invalidate()endfunction on.arrowRight() if init==0 then if initChoice<4 then initChoice=initChoice+1 end introduction() end platform.window:invalidate()endfunction on.arrowLeft() if init==0 then if initChoice>1 then initChoice=initChoice-1 end introduction() end platform.window:invalidate()endfunction 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()endfunction 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()endfunction 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()endfunction 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?endfunction 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()endfunction 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 " endendfunction 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 = 0endfunction 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)endfunction 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] endendfunction 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"endfunction charCreation() --init = 0 for the time the enterkey and arrow keys modify just the race selection if initChoice == 1 then race = "Human" hpmax = 13 mpmax = 5 strength = 2 dexterity = 1 intelligence = 1 defense = 1 speed = 1 points = 1 elseif initChoice == 2 then race = "Elf" hpmax = 10 mpmax = 7 strength = 1 dexterity = 1 intelligence = 2 defense = 1 speed = 2 points = 0 elseif initChoice == 3 then race = "Halfling" hpmax = 10 mpmax = 5 strength = 1 dexterity = 2 intelligence = 1 defense = 1 speed = 2 points = 3 elseif initChoice == 4 then race = "Dwarf" hpmax = 10 mpmax = 5 strength = 2 dexterity = 1 intelligence = 1 defense = 2 speed = 1 points = 1 end --The rest is applied equally for ALL races game = 1 hp = hpmax mp = mpmax xp = 0 bag = 2 gold = 0 bankgold = 0 level = 1 day = 1 hppotion = 0 mppotion = 0 strboost = 0 strpotion = 0 dexboost = 0 dexpotion = 0 intboost = 0 intpotion = 0 defboost = 0 defpotion = 0 speboost = 0 spepotion = 0 herb = 0 helm = 1 armor = 1 shoes = 1 shield = 1 robe = 1 sword = 1 bomb = 0 molotov = 0 bow = 1 arrows = 0 arrowtyp = "normal" ring = 0 ringcure = 0 ringfear = 0 ringhealth = 0 ringl33t = 0 ringsight = 0 ringtrain = 0 ringwealth = 0 l33t = 7 lamp = 0 normal = 1 orb = 0 skillretreat = 0 skillrun = 0 skillscan = 0 fire = 2 fear = 9 burn = 0 ice = 4 light = 6 cure = 12 sight = 8 spellbolt = 1 spellheal = 0 spellstat = 0 spellstun = 0 poisdag = 0 pois = 0 poison = 3 stun = 0 train = 10 special = 1 scan = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} distance = 0 enburn = 0 enlife = 0 enpois = 0 boss1 = 0 boss2 = 0 boss3 = 0 boss4 = 0 gotboss1 = 0 gotboss2 = 0 gotboss3 = 0 gotboss4 = 0 init = 1 equipment() world() platform.window:invalidate()endfunction 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) elseif mainMenu == 0 and init == 0 then if initChoice == 1 then blah = 72 gc:drawArc(blah, 22+4*shm, 50 , shm+2,gameTime*18,105) gc:drawArc(blah, 22+4*shm, 50 , shm+2,180 + gameTime*18,105) elseif initChoice == 2 then blah = 122 gc:drawArc(blah, 22+4*shm, 28 , shm+2,gameTime*18,105) gc:drawArc(blah, 22+4*shm, 28 , shm+2,180 + gameTime*18,105) elseif initChoice == 3 then blah = 149 gc:drawArc(blah, 22+4*shm, 56 , shm+2,gameTime*18,105) gc:drawArc(blah, 22+4*shm, 56 , shm+2,180 + gameTime*18,105) else blah = 210 gc:drawArc(blah, 22+4*shm, 45 , shm+2,gameTime*18,105) gc:drawArc(blah, 22+4*shm, 45 , shm+2,180 + gameTime*18,105) end gc:drawString(line1, (w-swm)/2 , 20) gc:drawString(line2, (w-gc:getStringWidth(line2))/2, 20+shm) gc:drawString(line3, (w-gc:getStringWidth(line3))/2, 20+2*shm) gc:drawString(line4, (w-gc:getStringWidth(line4))/2, 20+3*shm) gc:drawString(line5, (w-gc:getStringWidth(line5))/2, 20+4*shm) gc:drawString(line6, (w-gc:getStringWidth(line6))/2, 20+5*shm) gc:drawString(line7, (w-gc:getStringWidth(line7))/2, 20+6*shm) gc:drawString(line8, (w-gc:getStringWidth(line8))/2, 20+7*shm) gc:drawString(line9, (w-gc:getStringWidth(line9))/2, 20+8*shm) gc:drawString(line10, (w-gc:getStringWidth(line10))/2, 20+9*shm) else gc:setFont("sansserif", "r", 9) gc:setColorRGB(0, 0, 0) --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("serif", "b", 12) gc:drawString("Equipment", w/2-(gc:getStringWidth("Equipment"))/2,h/2-70+she) gc:setFont("sansserif", "b", 8) gc:drawString("Sword", w/2-85, h/2-70+she*2) gc:drawString("Shield", w/2-85, h/2-70+she*3) gc:drawString("Helmet", w/2-85, h/2-70+she*4) gc:drawString("Armor", w/2-85, h/2-70+she*5) gc:drawString("Shoes", w/2-85, h/2-70+she*6) gc:drawString("Robe", w/2-85, h/2-70+she*7) gc:drawString("Ring", w/2-85, h/2-70+she*8) gc:drawString("Bow", w/2-85, h/2-70+she*9) gc:drawString("Arrows", w/2-85, h/2-70+she*10) local swe = gc:getStringWidth("Helmet") gc:drawString("- "..cursword, w/2-85 + swe, h/2-70+she*2) gc:drawString("- "..curshield, w/2-85+swe, h/2-70+she*3) gc:drawString("- "..curhelm, w/2-85+swe, h/2-70+she*4) gc:drawString("- "..curarmor, w/2-85+swe, h/2-70+she*5) gc:drawString("- "..curshoes, w/2-85+swe, h/2-70+she*6) gc:drawString("- "..currobe, w/2-85+swe, h/2-70+she*7) gc:drawString("- "..curring, w/2-85+swe, h/2-70+she*8) gc:drawString("- "..curbow, w/2-85+swe, h/2-70+she*9) gc:drawString("- "..curarrows, w/2-85+swe, h/2-70+she*10) end if showInventory == 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 shi = gc:getStringHeight("L") local swi = gc:getStringWidth("Intelligence") gc:setFont("serif", "b", 12) gc:drawString("Inventory", w/2-(gc:getStringWidth("Inventory"))/2,h/2-70+shi) gc:setFont("sansserif", "b", 10) gc:drawString("Items:", w/2-85, h/2-70+shi*2) gc:setFont("sansserif", "b", 8) gc:drawString("Lamps", w/2-85, h/2-70+shi*3) gc:drawString("Molotovs", w/2-85, h/2-70+shi*4) gc:drawString("Herbs", w/2-85, h/2-70+shi*5) gc:drawString("Bombs", w/2-85, h/2-70+shi*6) gc:drawString("Daggers", w/2-85, h/2-70+shi*7) gc:drawString("Life Orbs", w/2-85, h/2-70+shi*8) gc:setFont("serif", "b", 10) gc:drawString("Potions:", w/2-85 + 2*swi, h/2-70+shi*2) gc:setFont("sansserif", "b", 8) gc:drawString("HP", w/2-85 + 2*swi, h/2-70+shi*3) gc:drawString("MP", w/2-85 + 2*swi, h/2-70+shi*4) gc:drawString("Strength", w/2-85 + 2*swi, h/2-70+shi*5) gc:drawString("Dexterity", w/2-85 + 2*swi, h/2-70+shi*6) gc:drawString("Intelligence", w/2-85 + 2*swi, h/2-70+shi*7) gc:drawString("Defense", w/2-85 + 2*swi, h/2-70+shi*8) gc:drawString("Speed", w/2-85 + 2*swi,h/2-70+shi*9) gc:drawString("- "..lamp, w/2-85 + swi, h/2-70+shi*3) gc:drawString("- "..molotov, w/2-85+swi, h/2-70+shi*4) gc:drawString("- "..herb, w/2-85+swi, h/2-70+shi*5) gc:drawString("- "..bomb,w/2-85+swi, h/2-70+shi*6) gc:drawString("- "..poisdag, w/2-85+swi, h/2-70+shi*7) gc:drawString("- "..orb, w/2-85+swi, h/2-70+shi*8) gc:drawString("- "..hppotion, w/2-85 + 3*swi, h/2-70+shi*3) gc:drawString("- "..mppotion, w/2-85+3*swi, h/2-70+shi*4) gc:drawString("- "..strpotion, w/2-85+3*swi, h/2-70+shi*5) gc:drawString("- "..dexpotion, w/2-85+3*swi, h/2-70+shi*6) gc:drawString("- "..intpotion, w/2-85+3*swi, h/2-70+shi*7) gc:drawString("- "..defpotion, w/2-85+3*swi, h/2-70+shi*8) gc:drawString("- "..spepotion, w/2-85+3*swi, h/2-70+shi*9) end if showMagic == 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 shsp = gc:getStringHeight("L") local swsp = gc:getStringWidth("Magic Spells") gc:setFont("serif", "b", 12) gc:drawString("Magic Spells", w/2-(swsp)/2-15,h/2-70+shsp) 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 if showStatus == 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 shsp = gc:getStringHeight("L") local swsp = gc:getStringWidth("Intelligence") gc:setFont("serif", "b", 12) gc:drawString("Spells", w/2-(swsp)/2,h/2-70+shsp) 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 endendfunction round(num, idp) local mult=10^(idp or 0) return math.floor(num*mult+0.5)/multendfunction 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
Really impressive !Maybe that you should add images...