Log In  
Follow
WidgetOtaku

doing tech witchcraft

ddate for Picotron
by
[ :: Read More :: ]

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
P#146774 2024-04-18 11:58

[ :: Read More :: ]

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
P#146537 2024-04-13 12:54

[ :: Read More :: ]

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)

P#145972 2024-04-07 12:14 ( Edited 2024-04-12 22:41)

[ :: Read More :: ]

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"))
P#145857 2024-04-05 22:20

[ :: Read More :: ]

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.

P#145825 2024-04-05 18:42 ( Edited 2024-04-05 18:47)

[ :: Read More :: ]

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.

P#145785 2024-04-05 11:46 ( Edited 2024-04-05 18:47)

[ :: Read More :: ]

Can anyone tell me what’s the code for making a single image (from converted png) into a static wallpaper?

P#145402 2024-04-04 18:28 ( Edited 2024-04-05 18:47)

[ :: Read More :: ]

idk if the arm64 of Picotron will eventually come out, but I definitely can’t run the normal version on this specific Chromebook :/

P#145408 2024-04-03 21:30 ( Edited 2024-04-03 21:32)

[ :: Read More :: ]

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

Cart #ddate-4 | 2024-04-16 | Embed ▽ | License: CC4-BY-NC-SA
2

P#145494 2024-04-02 17:08 ( Edited 2024-04-17 00:00)

[ :: Read More :: ]

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.

P#145403 2024-04-01 21:18