Pet Rock
Virtual pet rock. Zero maintenance. Zero features.
| System | AWTRIX NG Scripts |
|---|---|
| Firmware | AWTRIX NG |
| Topic | Miscellaneous |
| Built by | Galadril |
| File | OAEKbwEFAKaC.ax · 3.5 KB |
| Icons | — |
| Published | 8 Sep 2026 |
A parody of Blueforcer's Clawd virtual pet crab :D
Virtual pet rock. Zero maintenance. Zero features.
OAEKbwEFAKaC.ax
# @name Pet Rock
# @desc Virtual pet rock. Zero maintenance. Zero features.
# @author Galadril
# @version 2.0
# @config name text "Rock name" default=ROCKY maxlen=12
# @config sound bool "Sound" default=false
import math
class PetRock
var SAYS,MENU,ICON
var st,sel,t0,txt,base,age,dist,tick,dust,nd
var nm,snd
def init()
self.nm=store.get("name","ROCKY")
self.snd=store.get("sound",false)
self.age=store.get("age",0)
self.dist=store.get("dist",0)
self.SAYS=["IT IS A ROCK.","NOTHING HAPPENS.","THE ROCK IS UNMOVED.","THE ROCK DOES NOT REQUIRE THIS.","YOU FEEL SLIGHTLY SILLY.","THE ROCK APPRECIATES NOTHING.","STILL A ROCK.","THE ROCK HAS NO OPINION ON THIS.","YOU HAVE ACHIEVED NOTHING.","THE ROCK WAS ALREADY FINE.","SEISMIC ACTIVITY: NONE."]
self.MENU=["FEED","PLAY","WASH","STATS","EXIT"]
self.ICON=[[1,0,3,0,0,1,1,1,2,1,3,1,4,1,1,2,2,2,3,2,2,3],[1,0,2,0,3,0,0,1,4,1,0,2,4,2,0,3,4,3,1,4,2,4,3,4],[1,0,2,0,3,0,1,1,2,1,3,1,2,2,2,3,2,4],[0,3,0,4,2,2,2,3,2,4,4,0,4,1,4,2,4,3,4,4],[2,0,1,1,0,2,1,2,2,2,3,2,4,2,1,3,2,4]]
self.st=0
self.sel=0
self.t0=0
self.base=-1
self.tick=0
self.dust=0
self.nd=0
end
def _beep(m)
if self.snd
if settings.get("soundEnabled")!=false
sound.rtttl(m)
end
end
end
def _glyph(g,ox,oy,c)
var i=0
while i<size(g)
pixel(ox+g[i],oy+g[i+1],c)
i+=2
end
end
def _say(s)
self.txt=s
self.base=-1
self.st=2
end
def _act(i)
if i==4
self.st=0
rotation.resume()
return
end
if i==3
self._say(self.nm+" AGE "+str(self.age/86400)+"D "+str(self.age%86400/3600)+"H DISTURBED "+str(self.dist)+" SEISMIC 0.0 STATUS ROCK")
return
end
self._say(self.SAYS[math.rand()%size(self.SAYS)])
self._beep("k:d=32,o=4,b=200:c")
end
def loop()
self.age+=1
self.tick+=1
if self.tick>=60
self.tick=0
store.set("age",self.age)
store.set("dist",self.dist)
end
end
def on_button(b)
if b!="select"
return
end
var now=now_ms()
if self.st==2
self.st=0
rotation.resume()
return
end
if self.st==0
self.st=1
self.sel=0
self.t0=now
self.dist+=1
rotation.pause()
return
end
self.sel=(self.sel+1)%size(self.MENU)
self.t0=now
end
def on_hide()
self.st=0
rotation.resume()
end
def duration()
return 15000
end
def _rock(night)
rect_fill(4,2,4,1,0x8A8A8A)
rect_fill(2,3,8,1,0x757575)
rect_fill(1,4,10,1,0x6B6B6B)
rect_fill(1,5,11,1,0x585858)
rect_fill(0,6,12,1,0x4A4A4A)
pixel(5,3,0xA5A5A5)
pixel(3,2,0x9A9A9A)
pixel(9,5,0x3E3E3E)
if night
pixel(10,0,0x5C7FBF)
pixel(11,0,0x5C7FBF)
pixel(12,0,0x5C7FBF)
pixel(11,1,0x5C7FBF)
pixel(10,2,0x5C7FBF)
pixel(11,2,0x5C7FBF)
pixel(12,2,0x5C7FBF)
end
end
def draw()
clear()
var now=now_ms()
if self.st==1
var el=now-self.t0
var c=0x8A7F6B
if el>1200
c=0xFFD34D
end
self._glyph(self.ICON[self.sel],1,1,c)
text(9,6,self.MENU[self.sel],0xF0E6D8)
var fh=el*7/2000
if fh>7
fh=7
end
if fh>0
rect_fill(30,7-fh,2,fh,0xD97757)
end
if el>=2000
self._act(self.sel)
end
return
end
if self.st==2
var laps=scroll_text(self.txt,0xC9C9C9)
if self.base<0
self.base=laps
else
if laps>self.base
self.st=0
rotation.resume()
end
end
return
end
var night=false
var h=hour()
if h>=0
if h>=22
night=true
end
if h<7
night=true
end
end
var g=0x1E4D1E
var tc=0x2A3A2A
var hc=0x4FC96F
if night
g=0x14203A
tc=0x1E2A3A
hc=0x5C7FBF
end
line(0,7,12,7,g)
self._rock(night)
var i=1
while i<7
pixel(14,i,0x241F1A)
i+=1
end
line(16,4,31,4,tc)
var sx=16+(now/120)%16
pixel(sx,4,hc)
if now>=self.nd
self.dust=now+400
self.nd=now+7000+math.rand()%9000
end
if now<self.dust
pixel(13,(now/130)%5+2,0x6B6B6B)
pixel(sx,3,hc)
end
end
end
return PetRock()
Install it on your AWTRIX NG
Your browser writes the script straight to the device on your network. It joins the app rotation right away.
Some browsers refuse to talk to a device on your network from a public page. Download the flow and paste it into the Scripts tab of your device, or install it from a terminal:
More flows for AWTRIX NG Scripts or Miscellaneous
Something wrong with this flow? Report it.