Link to video
New movie was in progress, but I've been dealt a bad RNG hand for the Puppy Levels and I haven't managed to fix the Lua script to help navigate them. Currently it's too annoying and time consuming to try everything blindly, and I haven't managed to find any faster solutions with the RNG calls I've been getting; hopefully I'll get it sorted this year.
Joined: 4/17/2010
Posts: 11658
Location: Lake Chargoggagoggmanchauggagoggchaubunagungamaugg
Looks awesome! Which version of the script are you using?
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Thank you. I've tried both the Jim2bizhawk.lua visible above and the EarthwormJim2 script which comes for free with Bizhawk, which complains about memory searching or crashes the emulator respectively. The Gens script still works, so I've still got an understanding of what it's trying to do, but unfortunately it's no good when TASing on Bizhawk.
Joined: 4/17/2010
Posts: 11658
Location: Lake Chargoggagoggmanchauggagoggchaubunagungamaugg
Flip wrote:
The Gens script still works, so I've still got an understanding of what it's trying to do, but unfortunately it's no good when TASing on Bizhawk.
It can be converted to a hawk script if that will help you.
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
-- feos, 2015-- + modification by r57shell in 2015local rw = memory.read_u16_be
local rl = memory.read_u32_be
lastcfg =0
dcfg =0
rngcount =0
rngcolor ="white"
rngobject =0
rngroutine =0
MsgTime =16
MsgStep =256/MsgTime
MsgTable ={}
bombs ={}
goback ={}
goforth ={}--25BBA0
cmdstr ={[0x00+1]="wait",[0x01+1]="jmp",[0x02+1]="call",[0x03+1]="ret",[0x04+1]="round jmp",[0x05+1]="def",[0x06+1]="idk",[0x07+1]="table",[0x08+1]="rndcall",[0x09+1]="clr",[0x0A+1]="text",[0x0B+1]="stop",[0x0C+1]="diff jmp",[0x0D+1]="smt",[0x0E+1]="incs",[0x0F+1]="save",[0x2b+1]="dec",[0x2d+1]="inc",[0x30+1]="p0",[0x31+1]="p1",[0x32+1]="p2",[0x33+1]="p3",[0x34+1]="p4",[0x35+1]="p5",[0x36+1]="p6",[0x37+1]="p7",[0x38+1]="p8",[0x39+1]="p9",[0x3A+1]="p10",[0x62+1]="bomb",[0x63+1]="down",[0x64+1]="up",[0x65+1]="upp",[0x68+1]="bonus",[0x70+1]="puppy",[0x72+1]="skip",[0x7a+1]="end",}functioncmdlen(ptr)local cmd = memory.readbyte(ptr)if cmd ==0xAthenreturn3elseif cmd ==0x1thenreturn5elseif cmd ==0x2thenreturn5elseif cmd ==0x7thenreturn5elseif cmd ==0x4thenreturn6elseif cmd ==0xCthenreturn6elseif cmd ==0x6or cmd ==0x5or cmd ==0xDor cmd ==0x72thenreturn2endreturn1endfunctioncmdname(ptr)local cmd = memory.readbyte(ptr)local an = cmdstr[cmd+1]or"unk"if cmd ==0xAthenlocal t = memory.readbyte(ptr+2)if t >=26and t <=30then
an = an .." ".."Round "..(t-25)elseif t ==25then
an = an .." ".."Use the Bomb"else
an = an .." ".. t
endelseif cmd ==0x6or cmd ==0xDor cmd ==0x72or cmd ==0x5then
an = an .." ".. memory.readbyte(ptr+1)elseif cmd ==0x1or cmd ==0x2or cmd ==0x7then
an = an .." ".. string.format("%X",rl(ptr+1))elseif cmd ==0xCor cmd ==0x4then
an = an .." ".. memory.readbyte(ptr+1).. string.format(" %X",rl(ptr+2))endreturn an
endfunctioniswait(ptr)local cmd = memory.readbyte(ptr)return cmd ==0xAor cmd ==0xBor cmd ==0x63or cmd ==0x64or cmd ==0x65or cmd ==0x3Cor cmd ==0endfunctionwritetofile(file, cfg)local rnd ={}local rndname =nilfor i=0,1000000dolocal cmd = memory.readbyte(cfg)local an =cmdname(cfg)local cl =cmdlen(cfg)local hex =""for z =1, cl do
hex = hex..string.format("%02X",memory.readbyte(cfg+z-1))endif cmd ==0x2bor cmd ==0x2dor cmd ==0x0thenfor z =1,10000doif memory.readbyte(cfg+z)~= cmd then
cl = z
breakendend
an = an ..' x'.. cl
endif cmd ==0x7then
table.insert(rnd,{rl(cfg+1), rndname});
rndname =nilendifiswait(cfg)then
an ="-".. an
else
an =" ".. an
end
file:write(string.format("%X %-12s %s\n",cfg,hex,an));
cfg = cfg + cl
if cmd ==0xFthenif memory.readbyte(cfg)==0xAand memory.readbyte(cfg+2)>=26and memory.readbyte(cfg+2)<=30then
file:write("======== Round "..(memory.readbyte(cfg+2)-25).." ========\n")
rndname ="Round_"..(memory.readbyte(cfg+2)-25);else
file:write("================\n")endendif i>0and cmd==0xBor cmd==0x3thenbreakendendreturn rnd
endfunctionwritecfg(fname, ptr)local file = io.open(fname,"w+")
file:write("======== main cfg ========\n\n")local rnd =writetofile(file, ptr)for i =1,#rnd dolocal r = rnd[i];local count =rw(r[1]);for j =1, count doif rnd[2]then
file:write(string.format("\n======== table %s %d ========\n\n", r[2], j))else
file:write(string.format("\n======== table %X %d ========n\n", r[1], j))endwritetofile(file,rl(r[1]+2+4*(j-1)))endend
file:close()end-- uncomment this if you want dumps--writecfg("puppy1.txt",0x275FDC)--writecfg("puppy2.txt",0x27658E)--writecfg("puppy3.txt",0x276ECC)functionDrawConfig(cfg, xpos)local h =7for i=0,25dolocal action = memory.readbyte(cfg)if action==0x62or action==8or action==3or action ==0xBthen color ="red"elseif action>=0x63and action<=0x65then color ="orange"elseif action>=0x30and action<=0x32then color ="green"elseif action>=0x66and action<=0x70then color ="#00a000ff"elseif action==0x7athen color ="white"else color ="#aaaaaaff"endlocal an =cmdname(cfg)ifiswait(cfg)then
an ="-".. an
else
an =" ".. an
endlocal cl =cmdlen(cfg)local hex =""for z =1, cl do
hex = hex..string.format("%02X",memory.readbyte(cfg+z-1))endif action ==0x2bor action ==0x2dor action ==0x0thenfor z =1,10000doif memory.readbyte(cfg+z)~= action then
cl = z
breakendend
an = an ..' x'.. cl
end
gui.pixelText(xpos,i*h+32,string.format("%X %s",cfg,an),
color)
cfg = cfg + cl
if i>0and action==0xBor action==0x3thenbreakendendendfunctionrandomsleft(cfg)local left =0for i =1,1000dolocal cmd = memory.readbyte(cfg)local cl =cmdlen(cfg)if cmd ==8then
left = left +1end
cfg = cfg + cl
if cmd==0xBor cmd==0x3or cmd==0xFthenbreakendendreturn left
endfunctionConfigs()ifrl(0xfffc2a)==0thenreturnendlocal rng =rl(0xffa1d4)local cfg0 =rl(0xfffc2a)local cfg1 =rl(0xfffc9a)
gui.pixelText(100,0,string.format("rng: %08X : %d",rng,rngcount),rngcolor)
gui.pixelText(220,0,string.format("Timeout : %3d of %3d",memory.readbyte(0xFFFC7D),memory.readbyte(0xFFFC7C)))
gui.pixelText(220,8,string.format("Something: %3d of %3d",memory.readbyte(0xFFFAA6),memory.readbyte(0xFFFAA7)))if memory.readbyte(0xFFFF2A)==0then
gui.pixelText(270,16,"Bonus: yes")else
gui.pixelText(270,16,"Bonus: no")endif lastcfg~=cfg0 then dcfg = cfg0-lastcfg end
lastcfg = cfg0
local cfg =rl(0xfffc2a)local left =0if(cfg >=0x275FDCand cfg <=0x27614C)or(cfg >=0x27658Eand cfg <=0x276797)or(cfg >=0x276ECCand cfg <=0x2770D6)thenDrawConfig(cfg,104)
left =randomsleft(cfg)elseDrawConfig(cfg1,104)DrawConfig(cfg,204)
left =randomsleft(cfg1)end
gui.pixelText(100,16,"Randoms left: ".. left)endfunctionSeek()
bytes =0
waves =0
steps =0local ret =""for bytes=0,10000dolocal cfg =rl(0xfffc2a)+bytes
local action = memory.readbyte(cfg)local newaction = memory.readbyte(cfg+1)if action==0x7athen
waves=waves+1
steps=steps+1endif action==0x63or action==0x64or(action==0and newaction==0)then
steps=steps+1endif action>=0x30and action<=0x32thenif newaction==0x70then
steps=steps+1elseif newaction==0x62then
ret = string.format("BOMB in %d waves %d steps",waves,steps,bytes)breakendelseif action==3then
ret = string.format("Forth in %d waves %d steps",waves,steps,bytes)breakelseif action==0xeand newaction==8then
ret = string.format("Back in %d waves %d steps",waves,steps,bytes)breakendend
gui.pixelText(100,8,ret)endfunctionObjects()local base0 =0xffa2eafor i=0,0x23dolocal base = base0+i*0x6elocal id = memory.readbyte(base)if id>0and id~=0x82thenlocal x =Clamp(rw(base+2)-4096-camx,0,310)local y =Clamp(rw(base+4)-4096-camy,0,214)local vel =rw(base+0x18)local a =rl(base+0x14)local color ="white"PostRngRoll(base,x,y)local hp = memory.readbyte(base+1)if hp ~=0then
gui.pixelText(x,y,string.format("%X\n%d",base,hp),color)else
gui.pixelText(x,y,string.format("%X",base),color)endendendendfunctionBounce()if memory.readbyte(0xffa515)==0x60then offset =8else offset =0endlocal counter = memory.readbyte(0xfffc87)local a0 =0xfffc88local d0 =(memory.readbyte(a0+counter)<<5)+offset
local a3 =0x25d482local vel =rw(a3+d0)local bounce =0if vel ==0x200then bounce =3elseif vel ==0x3e0then bounce =1else bounce =2end
gui.pixelText(0,0,string.format("next bounce: %d",bounce))endfunctionPostRngRoll(object,x,y)for i =1,#MsgTable doif(MsgTable[i])thenif object==MsgTable[i].object_ thenlocal color =0xff000000+(MsgTable[i].timer_-emu.framecount())*MsgStep
gui.line(120,8*i+8,x,y,color)
gui.pixelText(100,8*i+8,string.format("%X",MsgTable[i].routine_),color)endif(MsgTable[i].timer_<emu.framecount())then
MsgTable[i]=nilendendendendfunctionClamp(v1,v2,v3)if v1<v2 then v1=v2
elseif v1>v3 then v1=v3
endreturn v1
endwhiletruedo
camx =rw(0xffa172)
camy =rw(0xffa174)
frame = emu.framecount()Objects()Bounce()Configs()Seek()
lastframe = frame
emu.frameadvance()endfunctionDump()for p=0x275fea,0x277b79dolocal a = memory.readbyte(p)if a==0x62then
table.insert(bombs,string.format("%X",p))elseif a==8then
table.insert(goback,string.format("%X",p))elseif a==3then
table.insert(goforth,string.format("%X",p))endendprint("bombs:")print(bombs)print("")print("goback:")print(goback)print("")print("goforth:")print(goforth)print("")end--Dump()
emu.registerbefore(function()
rngcount =0
rngcolor ="white"
rngobject =0end)
memory.registerwrite(0xFFA1D4,function()
rngcount = rngcount+1
rngcolor ="red"
rngobject = memory.getregister("a1")
rngroutine = memory.getregister("a0")for i =1,50doif MsgTable[i]==nilthen
MsgTable[i]={
timer_ = MsgTime + emu.framecount(),
object_ = rngobject,
routine_ = rngroutine
}breakendendend)
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Well the prepackaged script basically crashes Bizhawk as soon as it's running whilst in a level. The original script spits out a whole bunch of errors in the Lua Output window which prevents frame advancement, ie "Warning: attempted read of 1653891761 outside the memory size of 4194304. Message Cap reached, supressing output." etc, and your recent one still gives the error "NLua.Exceptions.LuaScriptException: [string "main"]:350: unexpected symbol near '<'.
However, removing the <<5 from that line at least gives a working output, just with scaling off. I'll see if I can tidy it up a bit more, thank you.
Joined: 4/17/2010
Posts: 11658
Location: Lake Chargoggagoggmanchauggagoggchaubunagungamaugg
What bizhawk version are you using?
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
I've been using 2.6.3 which was the version my TAS was originally started on. I've just checked them on the latest version of 2.9.1, and the scripts and movies work which is a good sign.
Joined: 4/17/2010
Posts: 11658
Location: Lake Chargoggagoggmanchauggagoggchaubunagungamaugg
The font needed a bit of tweaking, update Post #527775.
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Could this please be moved to the game thread instead of this submission in particular?
[14:15] <feos> WinDOES what DOSn't
12:33:44 PM <Mothrayas> "I got an oof with my game!"
Mothrayas Today at 12:22: <Colin> thank you for supporting noble causes such as my feet
MemoryTAS Today at 11:55 AM: you wouldn't know beauty if it slapped you in the face with a giant fish
[Today at 4:51 PM] Mothrayas: although if you like your own tweets that's the online equivalent of sniffing your own farts and probably tells a lot about you as a person
MemoryTAS Today at 7:01 PM: But I exert big staff energy honestly lol
Samsara Today at 1:20 PM: wouldn't ACE in a real life TAS just stand for Actually Cease Existing