Posts for MUGG


Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
I want to output all items (that can be sold in shop) currently in my possession. So I put all items in a table which is before the "while true do" statement.
local itemsTbl = { 
[0] = "mushrooms",
[1] = "supermushrooms",
[2] = "ultramushrooms",
[3] = "maxmushrooms",
[4] = "nuts",
[5] = "supernuts",
[6] = "ultranuts",
[7] = "maxnuts",
[8] = "syrups",
[9] = "supersyrups",
[10] = "ultrasyrups",
[11] = "maxsyrups",
[12] = "1ups",
[13] = "1ups DX",
[14] = "goldmushrooms",
[15] = "herbs",
[16] = "redpeppers",
[17] = "greenpeppers",
[18] = "woohoo blends",
[19] = "hoohoo blends",
[20] = "chuckle blends",
[21] = "teehee blends",
[22] = "hoolumbians",
[23] = "chuckoccinos",
[24] = "teeheespressos",
--[32] = "woo beans",
--[33] = "hoo beans",
--[34] = "chuckle beans",
--[35] = "hee beans",
[48] = "bean badges",
[49] = "castle badges",
[50] = "pea badges",
[51] = "bean B. badges",
[52] = "counter badges",
[53] = "charity badges",
[54] = "bros. badges",
[55] = "miracle badges",
[56] = "ohoracle badges",
[57] = "mush badges",
[58] = "mari-lui badges",
[59] = "muscle badges",
[60] = "spiny badges AA",
[61] = "mush badges A",
[62] = "grab badges",
[63] = "mush badges AA",
[64] = "power badges",
[65] = "wonder badges",
[66] = "beauty badges",
[67] = "salvage badges",
[68] = "oh-pah badges",
[69] = "brilliant badges",
[70] = "sarge badges",
[71] = "general badges",
[72] = "tank badges",
[73] = "school emblem",
[74] = "steady badges",
[75] = "oho jee symbol",
[76] = "spiny badges A",
[77] = "bros. lifes",
[78] = "piranha swings",
[79] = "bros. rocks",
[80] = "lucky ribbons",
[81] = "mush badges A",
[82] = "soulful bros.",
[83] = "high-end badges",
[84] = "hand auras",
[85] = "sledge hearts",
[86] = "lucky bros.",
[87] = "bros. respects",
[88] = "bowser fists",
[89] = "bowser fangs",
[90] = "spike badges",
[91] = "chuckola badges",
[104] = "work pants",
[105] = "work jeans",
[106] = "bean pants",
[107] = "blue jeans",
[108] = "parasol pants",
[109] = "hard pants",
[110] = "heart jeans",
[111] = "plaid trousers",
[112] = "#1 trousers",
[113] = "safety slacks",
[114] = "shroom pants",
[115] = "shroom bells",
[116] = "shroom slacks",
[117] = "peachy jeans",
[118] = "mushwin pants",
[119] = "mushluck pants",
[120] = "scandal jeans",
[121] = "street jeans",
[122] = "tropic jeans",
[123] = "hermetic jeans",
[124] = "beanstar pants",
[125] = "peasley slacks",
[126] = "queen B. slacks",
[127] = "B. brand jeans",
[128] = "heart slacks",
[129] = "casual slacks",
[130] = "bubble's gears",
[131] = "chuckola pants",
[132] = "smart pants",
[133] = "school slacks",
[134] = "oho jee wears",
[135] = "oho gears",
[136] = "casual corals",
[137] = "piranha suits",
[138] = "anuboo jeans",
[139] = "ancient pants",
[140] = "heavy slacks",
[141] = "light slacks",
[142] = "harhall's pants",
[143] = "jeanie jeans",
[144] = "wool trousers",
[145] = "random slacks",
[146] = "jeaniest jeans",
[147] = "safe guards",
[148] = "iron pants"
}
key = offset value = itemname Mushrooms are stored at 0x48E2 Supermushrooms are stored at 0x48E3 etc. If I don't have one of an item, the address value will be FF or 00. I can only carry 99 (decimal) of an item at max. After the "while true do" statement, I run this code in order to output my items:
itempos=0
for offset, itemname in pairs(itemsTbl) do
    if memory.read_s8(0x48E2 + offset) > 0 then
            gui.text(200,100+itempos, memory.read_s8(0x48E2 + offset).. "x " ..itemname)
            itempos = itempos +14
    end
end
"itempos" will affect the y-position of each line so I output all items 14 pixels below each time. If the value at address+offset is greater than 0 then it should output the string and update "itempos". EDIT: It seems to somewhat work, but items are out of order... It outputs in this order:
6x syrups (correct)
1x oho jee wears (I don't have it. address might be wrong...)
1x supersyrups (correct, but should have been listed above oho jee wears...)
1x maxsyrups (correct, ...)
(some badges, they are correct...)
1x work pants (correct)
1x work jeans (correct)
1x maxnuts (should have been listed above syrups...)
So I wonder why items are out of order (please refer to the itemtable above for the correct order - I would appreciate your help with fixing the wrong order). As for oho jee wears and other items that I'm not possessing, I will have to fix wrong addresses or find some other way to account for it. EDIT: When starting a new game, it looks nice but the items are still in the wrong order (correct would be: mushrooms, supermushrooms, 1ups, pants) How can I fix this? I'm going to be interested in learning about (click or other) events, so I can maybe put these items in an expandable rectangle.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
Nice job, looking forward to WIP videos if they do get posted here.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
Your current script is unnecessarily long and contains a lot of duplicate code: it could be made a lot more comprehensible (and maintainable) by moving some code to functions and some object-oriented programming. Feel free to completely disregard this, after all, these scripts are mostly for yourself, and if you're happy with them and don't see any need to improve your coding skill then that's okay. But if you'd like to ask some questions or get more help, feel free to pm me.
Thank you for your concern. I'm aware but I made this script initially just to display information on screen no matter how ugly the code was going to look - also whenever I try something new with lua, it takes me forever. Now, I could maybe re-organise some of the script and try to make a table for all items. But it would be optional; it does what I want so I'm going to be happy. I will understand that people want me to look at programming stuff myself instead of asking them, but I think, as for the luatable case, you could have posted the completed code snippet from the beginning. I will always need to see an example before I can understand it, and "try to use x instead of y" is just going to confuse me.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
Here is my finished lua script for Bizhawk. http://pastebin.com/VbFuv1rx In the next days I want to compare between console, Bizhawk, VBA and altabiscuit's descriptions to see how the glitch behaves in the English version on those systems.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
EDIT: Thanks but more changes needed to be made to this code in order for it to do what I wanted. This is the working code.
t = " "
for key, value in pairs(joypad.get()) do
    if tostring(value) ~= "false" then    t = t .." ".. tostring(key) end
end
gui.text(340,238,tostring(t))
EDIT: I will post my finished script over in the M&L topic.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
I've tried many things and I don't know what to try else so please post a complete solution.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
gui.text(200,200,tostring(joypad.get()))
will show "table: [8 digit hexademical which increments by 78 (hex) each frame]" ... I don't know why and what this is. Please give me a complete code that will do what I need.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
@Patashu: Your example worked, but when I try this
for key,value in pairs(joypad.get() ) do gui.text(200,200,value) end
it says wrong arguments to method call. (I realized the difference between joypad.getimmediate() and joypad.get(). What I want is to have input display such as in VBA, so I think joypad.get() is what I want.)
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
Could someone explain to me how I can display buttons currently pressed onscreen?
joypad.getimmediate * luatable joypad.getimmediate() * returns a lua table of any controller buttons currently pressed by the user
How can I convert luatable to string? The script is almost ready, by the way. Looking pretty good.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
Thank you natt. This solves my trouble. I'm going to finish adjusting my script and post it when it's done.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
Thank you for your effort. I think that I estimated the job wrong though. I thought the script would end up looking just like in VBA, but it doesn't. Text is neatly stroked in VBA, but pixelated and not stroked in Bizhawk. I tried to make changes to the script but I couldn't make it look nice at all and I have run into this problem: All values are zero when they shouldn't be. Bizhawk somehow only shows me 4 digit addresses in its hex editor*, memory search and memory watch although I'm running M&L in it. memory.readbyte, memory.read_s16_le, and all that don't seem to work...
text( 70+x, 6+y, memory.readbyte(0x020048e0), "yellow")
As well as other lines all show zeros (when it is not really zero). *In the case of the hex editor, I'm terribly confused about "memory domains". In VBA, memory viewer would show me all the addresses and it was nice. Bizhawk's hex editor shows me each memory domain itself with different address range (4 digit or 6 digit, ...). The memory domains aren't even the same between VBA and Bizhawk. IWRAM, WRAM, I/O, PALRAM, etc. are only in one emulator but not in the other. ___ After we find out what is the deal with values showing up as zeros, maybe I will try making a script myself.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
I second not using imgur unless you have an account because your image will be removed and replaced if you don't have an account.
I have yet to see an imgur image removed. Same with imageshack, actually. I've seen a lot of photobucket images removed though.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
Thank you very much! In VBA, the script will output something like this http://i.imgur.com/BqiZQ.png Just a bunch of values, RNG, position.. I could put most of this into a memory watch list but I prefer having all information on the screen in one small place where I can spot it easily. -Font/text/size may need additional adjusting because Bizhawk's lua text will be different (I think?). Please try to be close to the original, maybe I can do fine tuning later myself. The main job will be to adjust function names. -You can use a table for all the items as long as I understand the script later. -For the nut/mushroom/syrup graphics, is it possible to load small images instead of drawing it? -Please don't use too difficult coding. I want to be able to edit it later.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
I've gotten the game to run successfully in Bizhawk 1.8.2 (newest version on Sourceforge). Now I'm curious about adjusting my luascript. Please see this topic.
Post subject: Adjusting my luascript / Lua help
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
I'm considering TASing Mario & Luigi again. This time around, the English version may be faster than the Japanese, but VBA24m has emulation issues in the English version. People have mentioned Bizhawk so I will check if the issues are fixed in Bizhawk. I'm using Bizhawk 1.8.2. For your information, these are the emulation issues: - "Action Command Glitch" lets you acquire action commands you're not supposed to have. But there are differences between console and emu. Either 1) the same action command "ID" will give different commands between the two, or 2) advancing the action commands works differently between the two (so you skip ahead more/less than you're supposed to). This issue is only true for the English version. The glitch works correctly in Japanese. - The action commands that can be acquired using the "Action Command Glitch" sometimes cause the screen to be graphically glitched, while the game is lagging. This behavior differs between console and emulator for English and (to a lesser extent) for Japanese. The screen may be graphically glitched on console but the same screen may do nothing in VBA24m - or the game may be lagging continuously on console but only lags for 2 frames in VBA24m, etc. It would be a good thing (and if Bizhawk turns out to be the go-to-emulator for GBA TASing, it would be mandatory) to adjust my luascript to make it work in Bizhawk. It's fairly simple although kind of lengthy. http://pastebin.com/SZj73czH I would really appreciate it if someone could help me adjust it. You will earn an internet cookie and my love. And maybe even a grand Mario & Luigi TAS that might be sub 1 hour.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
jlun2 wrote:
jlun2 wrote:
How different is the behavior in BizHawk?
Has this been tested or is it the same as vba m?
I was under the impression BizHawk's GBA emu isn't ready yet. No, this has not been tested. ...But I rather not use an emulator I'm not familiar with and confident in when it's about TASing a game on a high level. If however, someone is willing to rewrite my lua script for bizhawk, if there is a memory reader (where I can directly edit values) and memory search, and if Mario&Luigi is confirmed working with no emulation issues, then I will take another look at it.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
English: Press L 12 times, hop off, Press L 2 times
As my EDIT said, on vba-24m this takes 12 L presses and only 1 subsequent L press. I did test this at least three times so it isn't random skipping ahead. If not too much trouble, please also describe or post your pastebins so I know what you do in certain situations: - What do you do in Teehee Valley in order to skip past the rock towards Popple/Birdo? - What do you do in order to enter the exitway in Bowser's Castle? Do you have to cycle through all glitch commands after you "barrel hop" on Luigi or is there away to prevent that? - What do you do to perform both "hat clips"/"huge skips" in Teehee Valley? How many L presses etc.? - What do you do in the 2nd room after entering the yellow pipe towards Popple/Birdo? I saw there was a video for it - are you aware of it? Do you do the same thing as in the video? Testing all these on emu will help me see if they're doable and how severe the differences are. Also in the future, I want to try to optimize those tricks if possible.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
Get stored barrel commands, break barrel, walk up to sign Swap bros, Press L 10 times* Swap bros, jump on Luigi with Spin jump, face opposite direction, jump off Swap bros, press L twice
On VBA-24m this takes 4 L presses instead of 10 to get Luigi's Spinjump. There are also no visual or audio cues whatsoever.
Should have Spin Jump on Back Luigi at this point Step away from the sign so Mario gets a regular jump icon Jump on Mario with Spin Jump, Press R 15 times**, Jump off Mario
On VBA-24m this takes 1 R press and 2 subsequent R presses, or 2 R presses and 1 subsequent R press to get "jump out of ground" for Mario.
Should have "Jump out of Ground" icon on Mario Jump out of ground, swap bros, switch Back Mario to Hammer, swap bros again Walk to sign, swap bros, Press L once (Back Mario will have a small X)
This works correctly. Please also post how many L-presses I need to get "jump on barrel" now, using a small tunnel. (EDIT: I need 12 L presses to advance to ID30 (ID31 is "jump on barrel")) I could always do a TAS with the glitch slightly different but I'm not sure... I also don't know how or where to post a bug report, not that I'm confident at all if anyone will look into it. I thought klmz is working on the emulator and his last update was in April 2013?
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
I do not have the means right now to test on console but here are some old posts:
25th Jan 2014 wrote:
What else I found out: The minimario->barrel glitch behaves differently between emulator and console on English. On emulator, I would set up the glitch, start the high jump, and press L 18 times (as in Japanese) and I would get "jump on barrel". But on console I always got "nothing". It is possible to get "jump on barrel" on console in English by setting up the glitch, start highjumping, pressing L 11 times, where the screen has to be mildly flickering at the 9th screen and the last screen. Then you stop highjumping and press L two times. Note: I got one case where I got "jump off of barrel" after 1 L press after highjumping was done. -> Very slight chance of the glitch working differently every time? I.e. the same action command ID might give you something different very rarely? (I dont think so) -> When doing barrel glitch, the same ID gives different action commands between console and emulator. Therefore, English glitched runs shouldn't be done on emulator. Emulator doesn't emulate the glitches (peach speech, barrel glitch) correctly on English.
25th Jan 2014 wrote:
When doing the action command/barrel glitch, there are differences with the screen flickering. So, as an example, when you're at a particular action command ID, the console may flicker a bit and the emulator only flickers once (2 lag frames) and then never again. Those are slight differences because flickering doesn't change anything. The differences between English console and English emulator are strong though. Because the same action command ID gives a different icon. ID 31 for Mario when behind Luigi, gives "nothing" on console and "barrel" on emu.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
Yesterday, I was discussing with altabiscuit on Twitter if English or JP will be faster for the next TAS. Either way, I'm going to have to look at his WR videos for both versions. 1. English Cackletta 1200 HP vs. Japanese Cackletta 800 HP 2. English Cackletta exposed heart stays 3 turns vs. Japanese stays 2 turns Heart stays exposed always 2 turns on both versions. 3. English Mushbadge boosts are far greater than in Japanese 4. There will be more skips to do in English because you cannot "barrel clip" in English so you have to rely on other tricks. 5. Also, in English the levelup roulette doesn't cap at 1 after you took the same thing a few times in a row. You can keep getting 3's for HIGE or POW as you like. 6. VBA-24m doesn't emulate the glitched action commands correctly in English. Might need more investigation or looking back at some posts I made a few months ago (where I talked about emu differences). 7. Cackletta's soul on English gets the first turn. 1: puts Japanese in favor 3: puts English in favor 4: TAS will do all skips very quickly. But places such as Teehee Valley, skipping past the rock in English may take a lot of time (10~15 seconds). Maybe it is possible to "hat clip" leftwards through the row of rocks and then go up to the next room like that. (It would be pretty crazy for Mario & Luigi TASing to go that way, just "teleporting" through every room. But according to my research, teleporting can only be done right after you enter a room. You cannot walk around a bit and then do it) I'm not sure what altabiscuit does to enter the exit way in Bowser's Castle in English (hop on Luigi and have to go through all commands, costing 3~6 seconds in TAS, or can you prevent that time loss?). I'm not sure either what altabiscuit does in Teehee Vally heading to Fungitown. TAS on Japanese could just barrel clip through everything, but English...? Might cost a lot of time putting Japanese back in favor again. 5: Good little bonus for English, but not really important. 6: This could be a huge problem. If glitched action commands behave vastly differently between English console and English emulator, I won't be able to use the English version. In that case I'm going to take the Japanese version without a question. 7: We can luck manipulate her to charge pow and def maybe, which would then only cost 5 seconds.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
Yeah, for a while I was confused if you learn Thunder Bros by learning the hand power or by reading a scroll from the hammerguys' cave. Now I see you have to go through the tutorial in Gwarhar Lagoons where you use a back brother's hand on the front brother (according to Floogal). Of course going through that tutorial would take too long.
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
Ah that page has everything I ever wanted to ask. Thanks
Editor, Experienced Forum User, Published Author, Expert player (2315)
Joined: 5/15/2007
Posts: 3856
Location: Germany
Can anyone explain to me what the current route is and how this "Ultra hammers early" trick is going to be useful? I haven't been keeping track of the discoveries recently, so I'd love some information to read. What is "flurrie slide"?
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
Two things I can say right now: - People may produce suboptimal TASes when they're offered money. They may not go back and redo a thousand frames in order to save 2 milliseconds but may aim to complete the TAS as fast as they can. I also have learned that you will never make enough money to justify not taking an actual job. Money you can make off of a Youtube partnership isn't worth noting (unless you're Swordlesslink and have videos with 1 million views). And I have never seen people donate notable amounts of money for the production of a TAS. I have also learned that money makes people crazy and jealous. It may be for the better to just ignore it and keep doing TASes just for fun and when it's not feeling like a chore. - This topic may be related http://tasvideos.org/forum/viewtopic.php?t=9107&highlight=