Log In  


Pico-8 Injects

If you dont know what an "inject" is, ill explain it here.

An inject is a script or program that you append (add) to the end of another program to serve a function. good examples of an inject are code snippets you add to the end of a cartridge to alter things in real time or gain extra functions. RTCP is a great example of a code inject (code below). you simply just add the inject in a new code tab, and it automatically does its set function(s) without having to modify the source code.

Here are a few injects i have created

RTCP

--[[ rtc-p+ ]]--
--portable rtc made by antibrain
cf,clvl,ct=150,100,0
if _init!=nil then _init()end
function rtc()
if cf<0then cf=0elseif clvl<0then clvl=0end
menuitem(1,"corrupt spd:"..cf,function(b) icf(b) end)
menuitem(2,"corrupt lvl:"..clvl, function(b) iclvl(b) end)
menuitem(3,"nxt crpt in:"..-(ct-cf))
ct+=1
if ct>=cf then ct=0
for i=1,clvl do
poke(abs(rnd(-1)),rnd(-1))
end end end
function icf(b)
if(b&2>0)then cf+=10 rtc()end
if(b&1>0)then cf-=10 rtc()end 
return true end
function iclvl(b)
if(b&2>0)then clvl+=10 rtc()end
if(b&1>0)then clvl-=10 rtc()end 
return true end
while true do 
rtc() if _update!=nil then _update()
elseif _update60!=nil then _update60()
end if _draw!=nil then _draw() end
flip()
--the below loop can be removed if you are short on tokens.
if (_update==nil or _update60==nil) and _draw==nil then
?"no update or draw loops found!"
?"for carts that dont use"
?"game loops, load #rtcp and"
?"use that instead."
?" "
?"if loaded off bbs, please"
?"use a pico-8 editor to use this."
stop()end end

ACID (EPILEPSY WARNING)

-- [[ acid inject ]]
do 
local function corruptstr(txt)
local replacements,new="abcdefghijklmnopqrstuvwxyz#!@$%^&*()_+{}\"\\',<>.?/;:[]",""
for i=1,#txt do
new=new..(rnd()>0.8 and replacements[flr(rnd(#replacements))+1] or txt[i])
end return new end
local _pal,_print=pal,print
pal=function()
for i=0,16 do 
_pal(i,rnd'-1') end
bg_col=rnd'-1'end
print=function(txt,x,y)
txt=corruptstr(txt)
for ox=-1,1 do for oy=-1,1 do
_print(txt,x+ox,y+oy,0)
end end _print(txt,x,y,7)end
end




[Please log in to post a comment]