COLLABORATION WITH @0x1096d274 !
(if anyone knows how to properly mark a cart as a collaboration please let me know)
attn: @zep
A tab character is supposed to move the cursor to the next column that's a multiple of the tab-width setting, but instead it just advances the cursor by tab-width columns every time.
In other words, it currently does this:
function do_tab() cursor_x += tab_width end |
And it should do this:
function do_tab() cursor_x = (cursor_x + tab_width - 1) % tab_width end |
Hello PICO-8 community! I have a somewhat large problem. Today, during school, I was told to sign out of my user, and I did the thing we needed to, and when I had reopened the tabs upon login, the cartridges on the BBS had lower quality! The pixels were blurred, and it is just kind of annoying to be playing a good game that has pixels for display, and the pixels are fuzzy. So, if anyone else has had a problem like this, can you help me out?
I'd like to be able to rebind the various IDE actions to different keys, as some of them are frustrating for me to use. This includes the capacity to bind multiple keys to the same action, and multiple actions to the same key.
Normally I don't like presenting my own personal case that prompts these general requests, but I feel like this time it won't detract from the original argument.
I personally need to rebind the keys for the SFX editor, because the “piano-like layout” for typing notes is impossible for me to wrap my head around, to the point where I genuinely can't use it. I can show you what I mean if you want, but remember that the request is for everything to be arbitrarily rebindable.
I tweeted at Zep some weirdness about the new block comment feature (CTRL+B) not working properly for the first line of a given tab.
This was fixed, but in testing it, I discovered this other weird behavior with CTRL+B. The cursor seems to move every time you hit the key combination, but will continue modifying the same line. It's not a super important detail, and ultimately doesn't really matter; who the hell is going to spam comment/un-comment for single lines?
Me, I guess. I am.
EDIT: Additional details: This only happens on lines that are not already commented, and only if there is no initial text highlight before CTRL+B is pressed.
EDIT2: It also happens on commented lines with many additional leading '-'s, mashing CTRL+B will remove leading dashes a pair at a time, while also advancing the cursor like in the above gif.
EDIT3: I just keep finding new interesting things! In this image I have pasted a large amount of HTML code from another project I'm working on right now. By pressing CTRL+B a couple (2) times at the bottom of the file, it jumps me back up to the top of the tab.
Hey PICO-8 people! Builds for 0.1.12 are now live on Lexaloffle and Humble. UPDATE: PocketCHIP users can get it here.
If you just want to see what's new, please scroll down a bit. But first of all, I should issue a..
Breakage Warning!
Future Compatibility: You'll need to update to 0.1.12 to play cartridges made in 0.1.12 or later. This update is another attempt at eternal future compatibility (can handle any future carts). There were a few bugs in 0.1.11g that needed a cart version bump to fix, and so I also took the chance to tweak the API (more on that below).
It may be a side effect of fixing the peek4() CPU cycle exploit, but now all “adjusted” functions seem to cost the same as if they were standard Lua API calls.
The following program used to run at 21.6% CPU on 0.1.11f. Now on 0.1.12b it runs at 64.5% CPU!
function _draw() cls() local i = 0 for j = 0,10000 do i = bxor(j, shl(i, 3)) end print(tostr(stat(1)*100).."% cpu", 2, 2) end |
Hi !
I'm working on a game project since several months.
The player moves in a dungeon in top view, like a 2D zelda, generated randomly.
He must find a treasure randomly placed while avoiding the boss who will chase him from the moment the player is too close to the room where the treasure is.
Currently, I find myself a little blocked by the limitations in the code. Also I would like to separate the game into two cards. A first will take care of generating the dungeon, the location of the rooms, etc.
And the second for the gameplay.
Basically, to use the gameloop model, a cartridge will be used for the _init () function, say "init_dungeon.p8".
But the question is: is it possible?
Knowing that my game elements (dungeon, player, boss, treasure, etc.) are tables integrating functions, is it possible to transfer this from one cartridge to another?
I'm thinking of the cstore function for example:
cstore (0x4300, 0x4300, 0x1aff, "game_dungeon.p8") [ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=63573#p) |
It’s now possible to include .lua files, but PICO-8 seems to be very confused when they have CRLF line terminators, reporting syntax errors at weird locations.
Note that including .p8 files with CRLF line endings works just fine, but not if they have an UTF-8 BOM ( @Niarkou reported this a while ago: https://www.lexaloffle.com/bbs/?tid=31617). To summarise:
- .p8 with UTF-8 BOM: fail
- .p8 with CRLF: OK
- .lua with UTF-8 BOM: OK
- .lua with CRLF: fail
It’s not unusual to have CRLF line endings, even unwillingly; for instance, if I push a .lua file to Git from a Linux box (with LF line endings) then pull the file on Windows, by default it magically gets CRLF line endings. This can be configured but it may confuse users.
When loading a file via #include, pico-8 crashes when running the program from the command line, like "run".
The code loaded is tested and used correctly and does not cause the crash. Also, running via Ctrl+R works and behaves as expected.
Editor:
Result:
#include multi.lua m=multi(0,17) m:draw(10,10) -- this works when run with ctrl+r -- it crashes when running with "run" |
multi.lua
local multi = {} multi.__index = multi setmetatable(multi,{ __call=function(cls,...) return cls.new(...) end } ) local function getxy(index) local y = flr(index / 16) local x = index - y * 16 return x,y end function multi.new(tl,br) local self = setmetatable({}, multi) local tx,ty = getxy(tl) local bx,by = getxy(br) local w = bx - tx + 1 local h = by - ty + 1 self.tx = tx self.ty = ty self.bx = bx self.by = by self.w = w self.h = h return self end local function getindex(x,y) return x + y * 16 end function multi:draw(x,y) for u=0,self.w - 1 do for v=0,self.h - 1 do local index = getindex(self.tx + u, self.ty + v) spr(index, x + u * 8, y + v * 8) end end end |
It also would be great, if the folder for includes was the same folder as the cartridges (AppData).
In ROBLOX I am also learning how to code, but one thing stands out that I feel should be necessary.
What is supposed to happen is that it runs:
function _init() cls() spr(192,20,20,4,4) wait(3) end |
But it errors with
"Runtime error line 4 tab 0
wait(3)
Attempt to call global 'wait' (a nil value)
In _init line 4 (tab 0)
At line 1 (tab 1)"
Is there a way to make the program wait a few seconds without taking too much space?
Thanks :)
Made this game over the course of 2 days. I wanted to make something simple so I could familiarise myself with Lua so I made this. The best part is no matter where it spawns it will always hit the corner! Hope you guys enjoy. (Pls leave a star, I'd appreciate that :D)
Edit: Thank you so much for leaving such nice words about my game.
Update: Fixed a bug where if it spawned at x83 and moved right then it would clip out of the map.