Just found out that the “goto” function is actually implemented in Picotron; I’ve tested a pico8 code snippet by @ultrabrite and put it into the usual function _draw()
function _draw() cls() x=1 y=0 n=120 ::io:: d=rnd(2)>1 and 0 or 5 line(x+5-d,y,x+d,y+5,11) x+=6 if(x>n+6) x=1 y+=6 print(' ') if(y>n) y=n flip() goto io end |
I'm trying to make a simple text-adventure game within the terminal (using the arrow keys as input), but the print() functions for the various options aren't kept permanently on screen.
What am I doing wrong here?
cls(0) -- left = "80" -- up = "82" -- right = "79" -- down = "81" print("Press a key:") for kp = 79,81 do if key(80) and key(kp) then print("left") elseif key(81) and key(kp) then print("center") elseif key(79) and key(kp) then print("right") end end |
Is there a way for a keyboard entry when I need an integer from the user?
Especially for this:
https://www.lexaloffle.com/bbs/?tid=141477
On the line of
local playerHand = drawCards(5,cardDeck) |
to which 5 can be modified…
btw can the F keys be overridden to a specific integer? (ie. pressing F12 for an integer of 12)
based on the tutorial from here https://docs.coronalabs.com/tutorial/data/shuffleTable/index.html
local cardDeck = {"AS","AH","2S","3S","KH","QD","QS","KD","4D","10H"} math.random(flr(rnd())) local function shuffleTable(t) if (type(t) ~= "table") then print("warning") return false end local j for i = #t, 2, -1 do j = math.random(i) t[i], t[j] = t[j], t[i] end return t end cardDeck = shuffleTable(cardDeck) local currentIndex = 1 local function drawCards(num,deck) local cardsDrawn = {} for i = currentIndex, num do cardsDrawn[#cardsDrawn+1] = deck[i] end currentIndex = currentIndex + num return cardsDrawn end local playerHand = drawCards(5,cardDeck) print(table.concat(playerHand,"\n")) |
tbh I'm trying to program a digital oracle deck of cards for personal use, and I can't seem to find a way to code for "picking card(s)" without doubles. Maybe with some keyboard entry for indicating the program to choose x items from the randomized array.
I’m definitely not a professional programmer, albeit having a bachelors degree in information management.
So… is there anything that I can improve onto my ddate cart?
I think that I can add a “hand of Eris” in ascii with no problem.
Can anyone tell me what’s the code for making a single image (from converted png) into a static wallpaper?
idk if the arm64 of Picotron will eventually come out, but I definitely can’t run the normal version on this specific Chromebook :/
I'm so glad that I've finally made my first cart :3
Initially coded on Picotron 0.1.0e
Please note that the date is now synced to local time as of version 1.4!
Added "Hand of Eris" as of version 1.3
I’ve tried to use the “stat(x)” function to call in the local system’s time, but it seems that this isn’t yet implemented.