alexr [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=10816 Pattern Playground <p>Pattern Playground lets you select and modify the fill patterns and colours of various shapes in a set, see the rendered results, choose a combination that you like, and output its values to the console.</p> <p>It helped me get a better grip on patterns while working on some other yet to be released project.</p> <h2>Instructions</h2> <h3>Selection / Editing Contexts</h3> <ul> <li>Set (as in, a grouping of shapes) selector</li> <li>Object (as in, shape) selector</li> <li>Current object (base) colour selector</li> <li>Pattern editor</li> <li>Pattern on-bits colour vs. transparency toggle</li> <li>Pattern on-bits colour selector</li> </ul> <h3>Controls</h3> <ul> <li>U/D/L/R to navigate across and within contexts</li> <li>[X] to toggle/select</li> <li>[Z] to print current set object patterns and colours to console</li> </ul> <h2>Sets</h2> <h3>Mixed</h3> <img style="margin-bottom:16px" border=0 src="/media/10816/10_pattern_playground_mixed.png" alt="" /> <h3>Prairie</h3> <img style="margin-bottom:16px" border=0 src="/media/10816/pattern_playground_prairie.png" alt="" /> <h3>Mars</h3> <img style="margin-bottom:16px" border=0 src="/media/10816/pattern_playground_mars.png" alt="" /> <h3>Noir</h3> <img style="margin-bottom:16px" border=0 src="/media/10816/pattern_playground_noir.png" alt="" /> <h2>Changelog</h2> <h3>1.2</h3> <ul> <li>add missing kvs to log output (id, shape type, x,y,w,h, combined color, pattern)</li> <li>prairie is auto-generated</li> <li>added new auto-generated set &quot;noir&quot; (as in, film)</li> <li>renamed desert to mars</li> </ul> <h3>1.1</h3> <ul> <li>sets added : desert, prairie sets</li> <li>set selector</li> </ul> <p> <table><tr><td> <a href="/bbs/?pid=144509#p"> <img src="/bbs/thumbs/pico8_pitotijdi-2.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=144509#p"> Pattern Playground 1.2.0</a><br><br> by <a href="/bbs/?uid=10816"> alexr</a> <br><br><br> <a href="/bbs/?pid=144509#p"> [Click to Play]</a> </td></tr></table> </p> https://www.lexaloffle.com/bbs/?tid=141101 https://www.lexaloffle.com/bbs/?tid=141101 Tue, 26 Mar 2024 10:25:26 UTC pal(a,b) cls(a) fills screen with a, not b <p>It took me a while -- as in, time spent inspecting code and debugging app -- to realize that <code>cls(a)</code> ignores prior <code>pal(a,b)</code> calls, hence filling the screen with <code>a</code>.</p> <p>Assuming this is not a bug, it would be good to mention this in the docs for that function.</p> <p>Cheers.</p> https://www.lexaloffle.com/bbs/?tid=140279 https://www.lexaloffle.com/bbs/?tid=140279 Wed, 21 Feb 2024 13:48:23 UTC Determining rendered text height for given string <p>Is there a way to determine rendered text height, knowing that said text may contain the tall rendering mode option ? I could search for the presence of &quot;\^t&quot; if I can find a way to express the escaped version of that.</p> <div> <div class=scrollable_with_touch style="width:100%; 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>-- always prints 6 local text = &quot;\^thello&quot; local h = 6 if sub(text,1,3) == &quot;\^t&quot; then h = 12 end print(h)</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> https://www.lexaloffle.com/bbs/?tid=140153 https://www.lexaloffle.com/bbs/?tid=140153 Fri, 09 Feb 2024 14:29:09 UTC [Solved -ish] runtime code to trigger reload+run <p>Is there a way to, at runtime, trigger a reload of the game (changed code, possibly with #include s, and all) ?</p> <p>Reason : I'm coding in an external editor and want to eliminate the edit-save-switch-run-switch loop by periodically, say within _update, trigger said reload+run.</p> <p>Thanks</p> https://www.lexaloffle.com/bbs/?tid=140069 https://www.lexaloffle.com/bbs/?tid=140069 Thu, 01 Feb 2024 13:39:02 UTC Are function overrides ignored in a console context? <p>I am getting different results when invoking code in the console as opposed to calling it from inside a running program. The code overrides the default behaviour of the cos function.</p> <div> <div class=scrollable_with_touch style="width:100%; 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>pi=3.14159 two_pi=pi*2 -- override cos to work with radians p8cos = cos function cos(rad) return p8cos(rad/two_pi) end -- degrees to radians function d2r(d) return d*two_pi/360 end -- this test works (cos(45 deg) =&gt; 0.7071) function _draw() cls() print(cos(d2r(45))) 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 then run the code, observing correct results (0.7071).</p> <p>Invoking this from the console however: <code>print(cos(d2r(45)))</code> prints different results (0.2206).</p> <p>Are function overrides ignored in the console?</p> https://www.lexaloffle.com/bbs/?tid=47655 https://www.lexaloffle.com/bbs/?tid=47655 Tue, 03 May 2022 13:35:07 UTC [answered] How to load a BBS cart into Designer? <p>I'd like to learn from some of the carts here in this forum by loading them into Designer. Is that possible?</p> https://www.lexaloffle.com/bbs/?tid=41880 https://www.lexaloffle.com/bbs/?tid=41880 Fri, 05 Mar 2021 13:54:50 UTC [answered] Voxatron scripting first steps <p>What are the actual steps one must follow to begin scripting in Voxatron?</p> <p>EDIT<br /> It was right in the <a href="https://www.lexaloffle.com/vox_api.txt">API docs</a></p> <p>EXAMPLE (global script)</p> <ol> <li>create a script object, add it to the room, and edit it. <div> <div class=scrollable_with_touch style="width:100%; 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> old_draw = _draw function _draw() clv() old_draw() local dz = sin(time())*5 sphere(64,64,32+dz,8,7) end</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div></li> </ol> <div> <div class=scrollable_with_touch style="width:100%; 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></pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> https://www.lexaloffle.com/bbs/?tid=41797 https://www.lexaloffle.com/bbs/?tid=41797 Sun, 28 Feb 2021 02:59:34 UTC [answered] Can the camera follow the player? <p>Is it possible to configure the camera such that it follows the player in a game?</p> <p>EDIT<br /> via a script placed inside the player folder (will add code once I've got that worked out)</p> https://www.lexaloffle.com/bbs/?tid=41796 https://www.lexaloffle.com/bbs/?tid=41796 Sun, 28 Feb 2021 02:56:21 UTC String evaluation for function call purposes <p>Is there a way to evaluate a function call stored as a string, say &quot;cls(2)&quot;? I tried</p> <p><code>eval(&quot;cls(2)&quot;)</code></p> <p>but nope; no such beast.</p> https://www.lexaloffle.com/bbs/?tid=41160 https://www.lexaloffle.com/bbs/?tid=41160 Wed, 13 Jan 2021 16:34:01 UTC Argh! How do you make a door? <p>How does one create a door, then link 2 instances of it across rooms? I've read the docs but an overview of what makes a door is not enough. Step-by-step, up to date instructions would really help. &lt;nudge&gt; <a href="https://www.lexaloffle.com/bbs/?uid=1"> @zep</a>. :)</p> https://www.lexaloffle.com/bbs/?tid=37924 https://www.lexaloffle.com/bbs/?tid=37924 Wed, 13 May 2020 12:16:44 UTC The Getaway <p> <table><tr><td> <a href="/bbs/?pid=74275#p"> <img src="/bbs/thumbs/pico8_the_getaway_wip_1_2-3.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=74275#p"> the_getaway</a><br><br> by <a href="/bbs/?uid=10816"> alexr</a> <br><br><br> <a href="/bbs/?pid=74275#p"> [Click to Play]</a> </td></tr></table> </p> <p>You owe money to the wrong people and you only have a few minutes to pay it back. Grab the money bags and drop them at the safe house. Don't get caught. Don't run out of fuel.</p> <p>Inspired by <a href="https://en.wikipedia.org/wiki/Getaway!_(video_game)">Getaway!</a>, a crime-themed game designed by Mark Reid and published for Atari 8-bit computers in 1982.</p> <h2>Screenshots</h2> <img style="margin-bottom:16px" border=0 src="/media/10816/screenshot p8_0.png" alt="" /> <img style="margin-bottom:16px" border=0 src="/media/10816/screenshot p8_1.png" alt="" /> <h2>Controls</h2> <ul> <li>up/down/left/right: drive/steer</li> <li>x : speed boost</li> </ul> <h2>Changelog</h2> <h3>1.3</h3> <ul> <li>minor UI and help text adjustments.</li> </ul> <h3>1.2</h3> <ul> <li>easy level debt reduced to $2000, with a due date of 2 minutes.</li> <li>money bags sometimes appear closer to your location</li> </ul> https://www.lexaloffle.com/bbs/?tid=37193 https://www.lexaloffle.com/bbs/?tid=37193 Sat, 28 Mar 2020 15:34:38 UTC Using controller shoulder button presses in a specific pico-8 game <p>I have a controller connected to my laptop. To configure pico-8 for it, I did : launch Gamepad Tool &gt; Copy Mapping String &gt; append string to sdl_controllers.txt &gt; relaunch pico-8. This works well.</p> <p>Now, I would like to use the controller's shoulder buttons as replacements for the d-pad's dpleft (btn 0) and dpright (btn 1), respectively. Can this be done at all? Note that this is not for exported (to html) games but rather to those launched from the pico-8 console.</p> <p>EDIT:<br /> To be clear, I'd like to control a pico-8 game using a gamepad's shoulder buttons.</p> <p>EDIT2:<br /> GamepadTool mapping string, as entered in sdl_controllers.txt is this:<br /> <code>03000000bd12000015d0000000010000,Tomee SNES USB Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,platform:Mac OS X,</code></p> https://www.lexaloffle.com/bbs/?tid=36374 https://www.lexaloffle.com/bbs/?tid=36374 Thu, 26 Dec 2019 02:50:33 UTC Jammerboard (TweetTweetJam3) <p>Here's my 558-char TweetTweetJam3 entry, including memory poked sfx (thanks to <a href="https://www.lexaloffle.com/bbs/?uid=10210"> @eruonna</a> for documenting that). <table><tr><td> <a href="/bbs/?pid=0#p"> <img src="/bbs/thumbs/pico8_jammerboard-1.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=0#p"> jammerboard</a><br><br> by <a href="/bbs/?uid=10816"> alexr</a> <br><br><br> <a href="/bbs/?pid=0#p"> [Click to Play]</a> </td></tr></table> </p> https://www.lexaloffle.com/bbs/?tid=35946 https://www.lexaloffle.com/bbs/?tid=35946 Sun, 17 Nov 2019 11:40:21 UTC How to poke memory to create an sfx? <p>How do I create a middle c note in sfx 0 programmatically? I'm not sure on the formula to calculate the offset from 0x6000.</p> https://www.lexaloffle.com/bbs/?tid=35932 https://www.lexaloffle.com/bbs/?tid=35932 Sat, 16 Nov 2019 14:03:39 UTC input addresses <p>I want to control my pico game via html element event handlers. Given that, what memory address (pico8_gpio offset) must I poke at if I want to simulate a btn(0) event? Also, what's the offset for simulating additional player actions, say, btn(0,1)? Thanks.</p> https://www.lexaloffle.com/bbs/?tid=30277 https://www.lexaloffle.com/bbs/?tid=30277 Sat, 18 Nov 2017 10:25:43 UTC Code tab switching shortcut? <p>Is there a shortcut for editor code tab switching? Couldn't find it in the docs.</p> https://www.lexaloffle.com/bbs/?tid=30169 https://www.lexaloffle.com/bbs/?tid=30169 Wed, 01 Nov 2017 05:44:16 UTC pico-8 program function invocation from external script <p>(This may sound convoluted)</p> <p>Is it possible to invoke an embedded (&quot;export html&quot;) pico-8 program's functions from an external javascript file?</p> <p>In this particular case, I wrote a .js app that fetches remote data asynchronously (via ajax). I then want to map that data to a sequence of pico-8 program function names, invoking each one in turn at regular intervals.</p> https://www.lexaloffle.com/bbs/?tid=28072 https://www.lexaloffle.com/bbs/?tid=28072 Tue, 15 Nov 2016 13:51:00 UTC [feature request] Add viewport meta to make site more legible on mobile <p>I often browse the pico-8 forums on my mobile. On my phone (Samsung S4), I have to squint like a maniac because the contents of the pages are not rescaled by the browser, which they would be if the following viewport meta was on each page:</p> <div> <div class=scrollable_with_touch style="width:100%; 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> &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no&quot; /&gt; </pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>Can the person responsible for these forums (and web site in general) add that so that I can go back to &quot;squintless&quot; reading. :)</p> <p>Cheers<br /> Alex</p> https://www.lexaloffle.com/bbs/?tid=3876 https://www.lexaloffle.com/bbs/?tid=3876 Tue, 19 Jul 2016 15:19:18 UTC foreach does not iterate over table objects: normal? <p>Hi all.<br /> The following code doesn't work -- players don't get drawn.<br /> What am I doing wrong?<br /> Thanks in advance.<br /> Alex</p> <div> <div class=scrollable_with_touch style="width:100%; 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> players = {} function make_player(col) local p = {} p.x = 0 p.y = 0 p.color = col return p end function draw_player(p) rectfill(p.x-2,p.y-2,p.x+2,p.y+2,p.color) end function _init() players.home = make_player(1) players.visitor = make_player(8) end function _draw() cls() foreach(players, function(p) draw_player(p)) end </pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> https://www.lexaloffle.com/bbs/?tid=2516 https://www.lexaloffle.com/bbs/?tid=2516 Thu, 24 Sep 2015 10:12:18 UTC need glitch effects overview <p>Could someone explain how glitch effects similar to <a href="https://www.lexaloffle.com/bbs/?tid=1941">Benjamin Soul�'s Mr.Beam</a> were done? No code as much as an overview.</p> <p>Thanks in advance.<br /> Alex</p> https://www.lexaloffle.com/bbs/?tid=2398 https://www.lexaloffle.com/bbs/?tid=2398 Tue, 01 Sep 2015 22:44:26 UTC