1 2 3 4
8 9
Emulator Coder, Site Developer, Former player
Joined: 11/6/2004
Posts: 833
Just FYI, I've upgraded the smetroid.lua script to include monster hitboxes and HP displays... Since there's currently a new Super Metroid run out, some people might be interested.
Emulator Coder, Site Developer, Former player
Joined: 11/6/2004
Posts: 833
Any bug reports or feature requests? I'm listening... *feels sad nobody replies* (4 posts in a row is usually considered bad form, but still)
Player (88)
Joined: 11/14/2005
Posts: 1057
Location: United States
Damn, this thing is amazing... I just tried out your Super Metroid script, and boy that would have made my life easier. Any chance that the environment could get hit boxes too? Like all the platforms and stuff? I don't really have anything else constructive to say other than thank you. Now you won't have 5 consecutive posts :)
They're off to find the hero of the day...
Player (198)
Joined: 12/3/2006
Posts: 151
Don't be sad! After using this for a few days, I might have two more new feature requests:
  • Disable/enable all manual input (for automating purposes)
  • Direct pausing on frame boundaries (not sure if this is possible)
That's all I can think of right now. Other than that this application is just perfect and I'm pretty sure I'll be using it for every future TAS I make. :)
Editor, Expert player (2461)
Joined: 4/8/2005
Posts: 1573
Location: Gone for a year, just for varietyyyyyyyyy!!
Is it possible to make a script that automatically fast-forwards cutscenes, elevators and item pickups in Super Metroid? Is it possible to make a counter that counts how many times a certain memory address has had a certain value? (It could be used as a shot/death/kill/hurt counter for example.)
v01
Joined: 10/14/2007
Posts: 10
Location: Japan
because not a programmer, making Lua script very harder for me. but that's very interesting, and makes me happy.(Lua script i made for SMWhere.) what I only can do is watching your making Lua build, DeHackEd. good job.
It is obvious what I want to say is, so that is enough.
Joined: 10/15/2007
Posts: 685
v01 wrote:
sorry for my tooooo bad english
You spell better than most people who were born here, though. :) (Well, at least if YouTube and GameFAQs are of any indication)
Kirby said so, so it must be true. ( >'.')>
Active player (354)
Joined: 1/16/2008
Posts: 358
Location: The Netherlands
Aqfaq wrote:
Is it possible to make a script that automatically fast-forwards cutscenes, elevators and item pickups in Super Metroid? Is it possible to make a counter that counts how many times a certain memory address has had a certain value? (It could be used as a shot/death/kill/hurt counter for example.)
Im quite sure that the first one is possible (and easy) if the right memory addresses are known (maybe just let a script search for the first frame that the left/right arrow buttons affect anything) As for the second one... simply counting and reporting is very easy, but reverting to the proper value on a state-load is not yet possible i think so there's a new request.... some way of handling events such as (manual) savestate-loading/saving (not sure if there's other interesting events?)
TASes: [URL=http://tasvideos.org/Movies-298up-Obs.html]Mr. Nutz (SNES), Young Merlin 100% (SNES), Animaniacs 100% (SNES)[/URL]
Joined: 10/3/2005
Posts: 1332
DaTeL237 wrote:
so there's a new request.... some way of handling events such as (manual) savestate-loading/saving (not sure if there's other interesting events?)
It could plausibly be done with movie.framecount().
DeHackEd wrote:
Any bug reports or feature requests? I'm listening...
What do you think about a function like Sleep(DWORD milliseconds) to pass CPU time back to the emulator? In other words, to prevent snes9x from going insane when I try something like this:
while blocking do
readinput()
modifyguidisplaystuff()
if joypad5.start ~= nil then snes9x.frameadvance()
--Sleep(5)
end
Any means of passing an arbitrary amount of input to the script between frames is what I'm after, really. Preferably with gui/screen refreshing. I just haven't been able to think of any other solution.
Joined: 10/15/2007
Posts: 685
As a side note, thank you kindly for including WIP 1 timing support for playback alongside all the improvements. This is definitely my tool of choice. Edit: I should clarify - my main draws to 1.51 that 1.43+ lacked were the video modes that allowed plain image upscaling without forcing my laptop's onboard video into bilinear filtering. Simple 2x/Simple 3x on 1.43 lets me have my cake and eat it, too. </finickybitch>
Kirby said so, so it must be true. ( >'.')>
Emulator Coder, Site Developer, Former player
Joined: 11/6/2004
Posts: 833
A lot to reply to. I'll see how much I can cram into one post.
Aqfaq wrote:
Is it possible to make a script that automatically fast-forwards cutscenes, elevators and item pickups in Super Metroid?
while true do -- main loop

   if cutscene_starts_now then
      snes9x.speedmode("turbo")
      while not cutscene_ends_now do
         snes9x.frameadvance()
      end
      snes9x.speedmode("normal")
   end

   -- Other code goes here
   snes9x.frameadvance()
end -- main loop
As for memory addresses, I'll let you figure those out.
DaTeL237 wrote:
As for the second one... simply counting and reporting is very easy, but reverting to the proper value on a state-load is not yet possible i think so there's a new request.... some way of handling events such as (manual) savestate-loading/saving (not sure if there's other interesting events?)
This was the next thing I was thinking of. I've put some concept function descriptions in the savestate section of the API docs. Tell me what you think. I'll put some sample code up later to help clarify.
Dromiceius wrote:
What do you think about a function like Sleep(DWORD milliseconds) to pass CPU time back to the emulator? In other words, to prevent snes9x from going insane when I try something like this:
There was the idea of a snes9x.wait() function and it's loosely documented in the API section as a future development. Basically it would function like snes9x.frameadvance() but not actually do the emulation cycle. You'd give CPU control back to the main loop but it would behave as though you paused for exactly one frame. This should let you do more input using P5 (as you appear to be doing for input) and joypad.read() would give you updated values. As for the practicality, that's something I need to investigate further although I'm fairly optimistic.
Joined: 12/29/2006
Posts: 119
Location: Japan, Anjo
---
DiffCalc .NET Frameworks 3.5 required.
Emulator Coder, Site Developer, Former player
Joined: 11/6/2004
Posts: 833
What does it do wrong? What should it do? Can you give me a program that shows incorrect behaviour? I can not reproduce the problem. gui.transparency(0) works correctly for me.
Active player (354)
Joined: 1/16/2008
Posts: 358
Location: The Netherlands
DeHackEd wrote:
This was the next thing I was thinking of. I've put some concept function descriptions in the savestate section of the API docs. Tell me what you think. I'll put some sample code up later to help clarify.
Ah that looks great! While using callbacks was the obvious choice... I didn't think about the possibility to allow returned values! The value-counter should now be incredibly easy to implement (and would be a perfect demonstration of the use of these registers? :))
TASes: [URL=http://tasvideos.org/Movies-298up-Obs.html]Mr. Nutz (SNES), Young Merlin 100% (SNES), Animaniacs 100% (SNES)[/URL]
Emulator Coder, Site Developer, Former player
Joined: 11/6/2004
Posts: 833
Test version working correctly for savestates. Numbers and string only allowed. Slight changes (mostly irrelevant) to the API. The wait() function remains incomplete. I'll hammer on it tomorrow and probably release a new version unless anyone identifies and complaints.
mz
Player (79)
Joined: 10/26/2007
Posts: 693
DeHackEd wrote:
Version 0.05...
  • ...
  • snes9x.pause() will pause the emulator (and the script) until the user unpauses
Pardon my ignorance (and my horrible english), but can this thing pause RPG TASes everytime a box of dialogue is completed, until the watcher unpauses, and then go on with the rest of the movie? That would make them a bit more entertaining, for they're terribly boring right now. By the way, I haven't looked very much into this program because I'm more a Genesis and NES guy, but it seems really useful. I hope you can add something like this to FCEU or Gens whenever you have time.
You're just fucking stupid, everyone hates you, sorry to tell you the truth. no one likes you, you're someone pretentious and TASes only to be on speed game, but don't have any hope, you won't get there.
Joined: 10/3/2005
Posts: 1332
DeHackEd wrote:
I can not reproduce the problem. gui.transparency(0) works correctly for me.
I think there's a problem with gui.transparency not resetting correctly. I ran a script with gui.transparency(1), removed the call, ran it again, and it was stuck on transparency(1). Stopping the script causes the transparency to get stuck like that, ignoring calls to gui.transparency. Also, I notice Snes9x only cares about the last call to gui.transparency in the loop. So this:
    gui.transparency(3)
    gui.drawbox(x, y, x2, y2, "#FFFFFF")

    gui.transparency(0)
    gui.text(x, y, "Fuzzy pickle!")
...comes out completely opaque. It would be nice if it didn't, but it's no big deal.
Emulator Coder, Site Developer, Former player
Joined: 11/6/2004
Posts: 833
New version time. Highlights:
  • Transparency wasn't quite up to snuff. Colour glitches and the 1-3 range was backwards.
  • Savestate callbacks. Lua can even save data into a savestate to retrieve it at load time.
  • snes9x.wait() allowing you do skip emulation, either to allow the OS a chance to interface with snes9x or just kill time.
Lowlights:
  • GUI transparency requests - selective transparency - remains impossible without using the gd library to do the work for you. The reason is the gui drawing is saved to an off-screen buffer and then copied to the screen later. Per-pixel transparency isn't stored.
Version 0.06
upthorn
He/Him
Emulator Coder, Active player (388)
Joined: 3/24/2006
Posts: 1802
mz wrote:
DeHackEd wrote:
Version 0.05...
  • ...
  • snes9x.pause() will pause the emulator (and the script) until the user unpauses
Pardon my ignorance (and my horrible english), but can this thing pause RPG TASes everytime a box of dialogue is completed, until the watcher unpauses, and then go on with the rest of the movie? That would make them a bit more entertaining, for they're terribly boring right now. By the way, I haven't looked very much into this program because I'm more a Genesis and NES guy, but it seems really useful. I hope you can add something like this to FCEU or Gens whenever you have time.
I've got gens covered. LUA's just a bit behind a few other tasks I have on my plate at the moment.
How fleeting are all human passions compared with the massive continuity of ducks.
mz
Player (79)
Joined: 10/26/2007
Posts: 693
I didn't know it was so easy... I achieved what I wanted in a few seconds. :D This is for Chrono Trigger; it pauses the emulator everytime a box of dialogue is full:
while true do
	if memory.readbyte(0x7e0129) == 7 then snes9x.pause() end
	snes9x.frameadvance()
end
I bet this could be useful for inichi too, if he modified it to press A instead of pausing it. Anyway, thanks DeHackEd for this amazing thing! I can finally enjoy some RPG runs. :P
upthorn wrote:
I've got gens covered. LUA's just a bit behind a few other tasks I have on my plate at the moment.
That sounds great! Can't wait for it.
You're just fucking stupid, everyone hates you, sorry to tell you the truth. no one likes you, you're someone pretentious and TASes only to be on speed game, but don't have any hope, you won't get there.
Joined: 8/27/2006
Posts: 883
Yeah I hope to see Lua in gens. I'll be able to do a couple of script for the Shining Force 2 run :)
Emulator Coder, Site Developer, Former player
Joined: 11/6/2004
Posts: 833
Actually Upthorn plans Lua in Gens, or I can do it if I get a copy of up-to-date source for the project. (Right bow I'm too tired to be bothered to go looking for it myself)
HHS
Active player (282)
Joined: 10/8/2006
Posts: 356
I like using this new version. How about a way to redraw the screen while waiting for user input? There's also a bug where the wait() function fails to update controllers 2, 3, 4 and 5.
Emulator Coder, Site Developer, Former player
Joined: 11/6/2004
Posts: 833
Confirming those as bugs. The good news is that the GUI bug is easy to fix. The bad news as it is right now, the old GUI drawings would remain on screen. I'll have to make some changes to deal with that. As for the joypad input, that makes no sense whatsoever to me... but I'll investigate.
HHS
Active player (282)
Joined: 10/8/2006
Posts: 356
Perhaps drawing should also be disabled if the current frame is being skipped, so that things don't stack up on each other when using fast forwarding. Another problem is that the gui.drawline() function is unable to produce lines that slant upwards, it makes them horizontal instead. By the way, I think it could be nice to have a function that draws filled rectangles. An easy way to take care of drawing would be to create the screen buffer as a Windows DIB section. Then you could draw lines, boxes etc. with Windows functions, which perform automatic clipping, and still let Snes9x access the buffer normally. A side effect of this is that colors would have to be specified as B8G8R8 instead of the screen buffer's format. This is roughly how this would be done: // Declarations unsigned short*ScreenBuffer; int bmi[]={40,256,-239,0x100001,BI_BITFIELDS,0,0,0,0,0,0xf800,0x7e0,0x1f}; HBITMAP bmp; HDC dc; // Program start bmp=CreateDIBSection(0,(BITMAPINFO*)&bmi,DIB_RGB_COLORS,&ScreenBuffer,0,0); dc=CreateCompatibleDC(0); SelectObject(dc,bmp); SelectObject(dc,GetStockObject(DC_PEN)); SelectObject(dc,GetStockObject(DC_BRUSH)); // Clearing SetDCBrushColor(0x80000); Rectangle(dc,0,0,256,239); // Drawing (for example) SetDCPenColor(dc,color); MoveToEx(dc,x1,y1,0); LineTo(dc,x2,y2); // Program done DeleteDC(dc); DeleteObject(bmp); Oh, another minor bug. Clear watches and Cancel both have the same shortcut key in the Cheat search dialog.
1 2 3 4
8 9