lewsidboi [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=44552 Moon Missions <p> <table><tr><td> <a href="/bbs/?pid=83563#p"> <img src="/bbs/thumbs/pico8_moonmissions-9.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=83563#p"> Moon Missions</a><br><br> by <a href="/bbs/?uid=44552"> lewsidboi</a> <br><br><br> <a href="/bbs/?pid=83563#p"> [Click to Play]</a> </td></tr></table> </p> <h1>Moon Missions</h1> <p>My take on a lunar lander game, for the Pico-8.</p> <h2>Features:</h2> <ul> <li>One obnoxious flying saucer</li> <li>A catchy intro tune</li> <li>Semi-procedural levels</li> <li>Persistent high scores</li> </ul> <h2>Directions:</h2> <p>Try to land your lunar vehicle on the surface of the moon while keeping an eye on your fuel<br /> and landing speed. Do your part to advance science (and boost your high score) by passing<br /> through each level's &quot;data&quot; waypoints. Keep an eye out for alien interface!</p> <p>Tip 1: When your landing speed is too high to land, warning lights flash from within your ship.<br /> Tip 2: Keep your eyes out for each level's fuel cannister to get some extra range and boost your score.</p> <p>Playable in browser at <a href="https://www.lexaloffle.com/bbs/?tid=40106">https://www.lexaloffle.com/bbs/?tid=40106</a></p> <h2>Controls:</h2> <ul> <li>Up/Left/Right to control directional thrusters</li> <li>(❎) can also be used as an alternate for up thrust</li> </ul> <h2>Credits:</h2> <p>This game was designed and created by me, lewsidboi, for you.</p> <p><a href="http://lewsid.com">http://lewsid.com</a></p> <img style="" border=0 src="/media/44552/3_preview.gif" alt="" /> https://www.lexaloffle.com/bbs/?tid=40106 https://www.lexaloffle.com/bbs/?tid=40106 Sun, 01 Nov 2020 03:55:04 UTC Comparing numbers greater than 32,767 <p>How would I go about comparing numbers greater than 32,767?</p> <p>I'm using <a href="https://www.lexaloffle.com/bbs/?uid=12874"> @Felice</a>'s code from <a href="https://www.lexaloffle.com/bbs/?pid=22677">https://www.lexaloffle.com/bbs/?pid=22677</a>:</p> <div> <div style="max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre>function get_score_text(val) local s = &quot;&quot; local v = abs(val) while (v!=0) do s = shl(v % 0x0.000a, 16)..s v /= 10 end if (val&lt;0) s = &quot;-&quot;..s if(s==&quot;&quot;) then s=&quot;0&quot; end return s end </pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>I'm saving the three highest scores to the cart data. Unfortunately, I'm struggling to solve how to determine if the user's current high score (stored as a string) is greater than one of the other three. I'm looking for a function along these lines:</p> <div> <div style="max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre>function check_new_high_score() --high_scores = table of tables { 1 =&gt; (player_name), 2 =&gt; (player score) } for i=1,#high_scores do local raw_high_score = get_score_text(config.total_score) local raw_saved_score = high_scores[i][2] if(raw_high_score&gt;raw_saved_score) then return i end end return false end</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>Unfortunately, yea, this just fails because I'm comparing strings to each other with a comparison operator. I'd love to know how to resolve this, I've been struggling with it for some time. Things end up in weird places:</p> <img style="" border=0 src="/media/44552/Screen Shot 2020-10-07 at 6.51.12 PM.png" alt="" /> https://www.lexaloffle.com/bbs/?tid=39858 https://www.lexaloffle.com/bbs/?tid=39858 Wed, 07 Oct 2020 22:48:26 UTC