Posts for MUGG


Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
Deepcopy seems to be doing what I want. Thank you! I can now go on with my lua game.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
That one audio bug in Mario & Luigi I posted a while back is still present, in version 2.2, for your information.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
FatRatKnight wrote:
Creating a copy of a table, as opposed to simply assigning another reference, is a little more involved.
How to do it in this case? This doesn't seem to be working:
		for key, val in pairs(Actor) do
			roomData[currentRoom][2].key = val
		end
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
If I save an object Actor in a table like this,
Language: Lua

roomData[currentRoom][2] = Actor
does it save the keys/values themselves or just a reference to the object Actor?
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
Hello everyone, what would be a good way to grind all the characters in the game?
In Dusty Dunes desert there is enemy called Criminal Caterpillar, and in Scaraba there is Master Criminal Worm. Those appear very rarely and I think they will run from you but if you defeat one in battle you get a ton of exp. http://starmen.net/mother2/guides/scarabatrick/
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
@r57shell Thanks, but I considered that your approach wasn't quite trouble-free. For example, when falling and entering a wall tile, restoring would mean lifting the character, wouldn't it? And:
if you fall and collide -> you land on ground, thus you should push up. (...)
This is not so simple. a) What if the upper half of the character touches a wall while falling? In that case, he should continue falling. b) What if the character falls alongside a wall and touches it? He is falling in a wall, so according to your rule, he needs to be pushed up. But that wouldn't make sense. When moving left and into a ceiling, you shouldn't be pushed to the right, either, contrary to what your rules suggest. Sorry but I was very quick to go right ahead what I envisioned. And it works nicely now. It's not impossible for me to fix the repeated bouncing, maybe I will look at it later (It's just a matter of ejecting character 1 pixel less).
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
This is what I have right now. https://pastebin.com/jswhChWd https://paste.ofcode.org/DmXjDgGgE54YGxMrpaAuHz (Longer pastebin freezes my PC so I use different site) https://www.youtube.com/watch?v=P8EHWhcxYgc I ended up with a better collision check than before, but I'm wondering if it could be shortened and optimized further (see function named playerWallCollision).
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
Right now my code lets the character move and the collision check is supposed to adjust the character position. An idea, like r57shell suggested, could be to save the previous position and / or let the character only move if no collision was detected. I will have to test around with that. Otherwise it boils down to:
you still have the problem of what should be done when in the next frame the moving object is partially inside the obstacle
This. My image summarizes my results so far: https://i.imgur.com/sGDCx4h.png I wish there was a prettier solution because this what I'm showing off in the image would require taking into account which corner of the hitbox is in a wall, and that means writing code for all of these special cases. It's probably also not very nice on the performance. Thanks so far!
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
Masterjun wrote:
Looks like input.getmouse() is a problem in 1.13.0. Do you use that?
Yes I do. I tried a very simple script (see below) and it crashes. That seems to be the problem. I will update the github issue.
Language: Lua

local mousex local mousey while true do mousex = input.getmouse().X mousey = input.getmouse().Y emu.frameadvance() end
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
Luascript 0.12.6 Important notes: - Now the script runs in Bizhawk 2.x - Fixed script crash on emulator reboot - You cannot use the script in Bizhawk 1.13.0 and 1.13.1 because of some bug. Use 1.12.x or 2.x instead. Known issues: - Actors: The list sometimes isn't up to date with the current room. Didn't find a way to reproduce this issue consistently yet...
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
MUGG wrote:
I'm trying to code a game in Bizhawk in lua and it draws images on the screen. It works perfectly in 1.12.0 but in 1.13.0 I get all sorts of random errors, such as "file not found" and then it crashes. It's unusable. (...) Opened issue here.
It looks like it isn't related to gui.drawImage(). I tried running my Mario & Luigi script in 1.13.0 and it breaks after a short time even when I disable all instances of gui.drawImage().
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
I don't know why the desync happens but assuming you're on Bizhawk, try switching to the other GBA core, do it over and see it it happens again.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
Ok so I have a question. I'm making a game in Bizhawk lua and it's going to be a grid-based system where map tiles are 0 or 1 (nothing or walls). The character has a hitbox of a given width and height. My collision check checks any map tile that the hitbox covers. My question is, how should I code the wall ejection? I've tried a few things but I can't seem to make it good. Any ideas?
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
I ran into a different, more serious issue with files. Basicly I have this lua (which is heavily trimmed down from the original I was using)
Language: Lua

function GuiLoadSettings() settings = io.open("config.cfg","r") if settings~=nil then for line in settings:lines() do end settings:close() end end GuiLoadSettings() while true do print("hello world") emu.frameadvance() end
and a .cfg file with this content (There is 1 empty line before and after).

bool BoolAllowEdits : true
bool BoolBattle : false

If I run the lua in 1.12.0 or 1.13.0, it outputs:
hello world
hello world
hello world
and if I run it in 2.1.1. or 2.2, it outputs:
NLua.Exceptions.LuaScriptException: bool BoolBattle : false 
I'm not sure if it's a bug with Bizhawk or bad code usage on my part. Please help :) This is currently the only things stopping my Mario & Luigi script from running in 2.x. If you comment the for line in settings:lines() do bit out, it runs fine. Opened issue: https://github.com/TASVideos/BizHawk/issues/995
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
Wanted to clear something up I found today: In 2010, I stated that the Peach escorting bit is emulated wrong in older VBA versions (Peach gets caught immediately when offscreen as opposed to being able to go offscreen freely in Dragondarch's SDA run). I'm not completely sure but me stating VBA-M fixing the Peach escorting is probably misinformation too. The truth is, there is no Peach escorting emulation bug, it seems. The "bug" happens because TAS can clear Toadsworth's text fast enough to save Peach from getting caught the first time. If you do so, the game will continue to check if Peach is offscreen, even in the next few rooms. If she is caught in the first room, which she is in the SDA run, then she is allowed to walk offscreen from then on.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
It seems that if a luascript crashes, file handles are not automatically closed until you close the lua console. Example: Open Bizhawk 2.2, open luascript which opens a file but runs into an error. Open Bizhawk 1.2.0, open same luascript. You get this outputted in 1.2.0's console:
LuaInterface.LuaScriptException: [string "main"]:1567: bad argument #1 to 'output' (config.cfg: Permission denied)
Also, as a very small observation, probably unrelated to the "file permission" issue, when this message appears, the console will still show the green "play" triangle and say that 1 script is running. When you click anywhere, it updates to the red rectangle and 0 scripts running. Basicly what I observe is, if a luascript crashes, some stuff is not taken care of: - console behaves as if script is still running (green triangle etc.) - Bizhawk doesn't clear file handles until the console is closed
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
I'm surprised this game has got TASers besides me. @Amy, I feel conflicted if that Peach skip should be allowed. It's not a true glitch, just an exploit with the text getting cleared faster than was thought possible by the devs. As a side note, MrShasta managed to trigger a similar bug in his glitchless run. Since it hasn't been decided in the RTA community, it's probably something that can be left up to the TASer if they want to include it or not. You said you reached 11 minutes into the game? I'd be interested seeing that WIP, maybe we can work together.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
Wow, it's amazing how broken this game has become this year... That gate skip reminds me of OoT door of time btw.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
I put everything in the same folder, but this doesn't work. It only loads the gb ROM.
EmuHawk --lua="myscript.lua" "dummy.gb"
Thanks so far!
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
Are there any example command line scripts? (This) Is it possible to write a .bat that opens bizhawk, a rom and a lua?
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
I'm writing a game in lua code for fun. Question: Does using a lua canvas object provide more performance or is it ok to just draw stuff to the emu screen? I tried around with lua canvas but it seems lua canvas functions, such as LuaCanvas.drawRectangle(), haven't been implemented in 1.12.0, and I'm reluctant to try versions beyond that. edit: Is it possible to assign a function to a table, as opposed to the function result?
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
I'm trying to code a game in Bizhawk in lua and it draws images on the screen. It works perfectly in 1.12.0 but in 1.13.0 I get all sorts of random errors, such as "file not found" and then it crashes. It's unusable. Opened issue here. Also, when using client.closerom(), the lua console seems to break and you cannot load any more scripts until you restart the emulator. I've been wanting to use a function that just closes the script itself but that doesn't seem to exist.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
About your account, try to phonecall someone from Google and see how it goes.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
Tried to investigate (super) yoyo glitch but didn't get anywhere. I learned this much though: * If you place a hitbox on the ground and an opponent does a strong attack on it (it makes a clank sound), Ness will be repelled briefly. I tried having Ness in various situations while someone attacks his hitbox like that, but nothing special happened. If Ness gets thrown while he's supposed to be repelled, it just freezes him and the thrower for 3 frames and then resumes. * As you might know, the game remembers the last 12 things that have been hit by one hitbox. Assuming you are in training mode and have your hitbox hit several Mr. Saturn: Mr Saturn (1) is hit. Mr Saturn (1) leaves the map. Another Mr Saturn is summoned, then this one will be (1) now. It cannot be hit. If two Mr Saturn are summoned, then (1) cannot be hit but (2) can be hit. You need to summon three Mr Saturn in order to hit a third one, etc. Basicly, if an Mr Saturn was hit and leaves, a new one can replace it and the hitbox won't "realize" that it's not the same one. You can summon only about 12 items in training mode, but if you use the debug code you can summon pretty much until all slots are used. I'm guessing there are 32 slots. Maybe player characters and stage objects etc. are included in those slots. There is probably a list for each hitbox that tells what slots have been hit. This list can only carry 12 entries. I tried finding this in memory but I'm not good at using Cheat Engine and it takes minutes to make one search... It would have been interesting to see such a list actually update before my eyes so I could understand the conditions for when a hitbox will ignore something or hit something. Super yoyo glitch, as you might know, will just hit the same thing repeatedly. I guess the game fails to put the hit object in the list so the hitbox can hit something every frame or so. Of course this is assuming Super yoyo glitch isn't a hoax after all. * The game will treat phantom hits differently from normal hits. Hitboxes will remember if they hit something by phantom hit, so the same hitbox cannot phantomhit a thing multiple times (unfortunately). I'm wondering if phantom hits have their own "list". https://www.youtube.com/watch?v=sXhh-R9O8H0