- v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
- Use this page to report any issues related to the migration.
Difference between revisions of "Utility Talk:Tweak/Development"
m (moved User talk:Rick/Tweak/Development to Utility Talk:Tweak/Development: move utilities to the utility namespace, for searching, indexing, etc) |
|||
(5 intermediate revisions by 4 users not shown) | |||
Line 15: | Line 15: | ||
::Ah, maybe Show() and ShowDialog() behave differently, because I was setting it all up and the form would show up and I could do non-memory editing stuff. Thanks for the quick answer :) --[[User:Corc|Corc]] 14:30, 13 May 2008 (EDT) | ::Ah, maybe Show() and ShowDialog() behave differently, because I was setting it all up and the form would show up and I could do non-memory editing stuff. Thanks for the quick answer :) --[[User:Corc|Corc]] 14:30, 13 May 2008 (EDT) | ||
− | Is there a reference for the addresses available? Or how do I find the addresses? "map_data", "creature_body_part_health_vector_offset" ? I will compile a list if I can find them. | + | == addresses == |
+ | |||
+ | Is there a reference for the addresses available? Or how do I find the addresses? "map_data", "creature_body_part_health_vector_offset" ? I will compile a list if I can find them. --[[User:M2775|M2775]] 07:07, 28 May 2008 (EDT) | ||
+ | |||
+ | :There are xml files in a separate folder (for tweak itself) where you are able to define things for different versions of the game. It's best to check if the variable is available before using it though. Almost all the basic useful addresses and offsets are included in those files. --[[User:Corc|Corc]] 12:55, 28 May 2008 (EDT) | ||
+ | |||
+ | == I'm doing something wrong here... == | ||
+ | |||
+ | I'm trying to get the pointer to the data for the tile that is currently highlighted, like Tile Edit does. Here's what I have, but I must be doing something wrong. | ||
+ | <pre> | ||
+ | UInt32 mapx, mapy, mapz, mapxoffset, mapyoffset, mapzoffset; | ||
+ | mapx = memory.ReadU32(version.GetAddress("mouse_x")); | ||
+ | mapy = memory.ReadU32(version.GetAddress("mouse_y")); | ||
+ | mapz = memory.ReadU32(version.GetAddress("mouse_z")); | ||
+ | mapxoffset = mapx * 4; | ||
+ | mapyoffset = mapy * 4; | ||
+ | mapzoffset = mapz * 4; | ||
+ | UInt32 MouseMapOffset; | ||
+ | MouseMapOffset = memory.ReadU32(memory.ReadU32(memory.ReadU32(version.GetAddress("map_data")+mapxoffset)+mapyoffset)+mapzoffset); | ||
+ | </pre> | ||
+ | I've expanded it to figure out the problem as best I was able, and the first ReadU32 returns a pointer like it should, but the second one returns a value way too low to be correct (0x0013####) and when it reads that it ends up with a pointer way too high (0xD0######). | ||
+ | It's stumped me for the past 6 hours, so I turn to people more experienced than me in hopes of some help :) | ||
+ | →[[User:Valarnin|Valarnin]] 21:34, 17 July 2008 (EDT) | ||
+ | |||
+ | : From Tile Edit's source, | ||
+ | |||
+ | <pre> UInt32 map, xcount, ycount, zcount; | ||
+ | |||
+ | map = memory.ReadU32(version.GetAddress("map_data")); | ||
+ | |||
+ | if (map == 0) | ||
+ | { | ||
+ | MessageBox.Show("Map data is not yet available!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | UInt32 mousex, mousey, mousez; | ||
+ | |||
+ | mousex = memory.ReadU32(version.GetAddress("mouse_x")); | ||
+ | mousey = memory.ReadU32(version.GetAddress("mouse_y")); | ||
+ | mousez = memory.ReadU32(version.GetAddress("mouse_z")); | ||
+ | |||
+ | if (mousex == 0xFFFF8AD0) | ||
+ | { | ||
+ | MessageBox.Show("Please press 'k' to choose a tile.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | if (memory.Suspend() == false) | ||
+ | { | ||
+ | memory.Resume(); | ||
+ | MessageBox.Show("Failed to suspend process.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | xcount = memory.ReadU32(version.GetAddress("map_x_count")); | ||
+ | ycount = memory.ReadU32(version.GetAddress("map_y_count")); | ||
+ | zcount = memory.ReadU32(version.GetAddress("map_z_count")); | ||
+ | |||
+ | UInt32 block = memory.GetTileBlockAddress(map, xcount, ycount, zcount, mousex, mousey, mousez);</pre> | ||
+ | |||
+ | :: Hope that helps. —[[User:Rick|Rick]] 05:17, 18 July 2008 (EDT) | ||
+ | |||
+ | ::: Thanks, Rick, that was exactly what I needed. I don't know '''''How''''' I missed that function. I can only blame lack of sleep. →[[User:Valarnin|Valarnin]] 11:47, 18 July 2008 (EDT) |
Latest revision as of 20:16, 7 February 2010
K, I got it to work, I did have to redo the reference to the DLL. The reveal example worked too, once I referenced Windows.Forms. Looks like a pretty nice setup, I applaud! :) --Corc 04:00, 10 May 2008 (EDT)
module variables with forms[edit]
I'm mostly self taught so I most likely have bad habits in coding, so bare with me :)
I'd like to make a little form with options on it and then run code when certain buttons are clicked. I've got the form added to the project and couldn't quite figure out how to get a function from the Module class as an event for a button click without making the button public (in the form class) and adding it manually (in the module class) after I made a new instance of the form in the module run function. I also, wanted to store the memory/version/mode/etc arguments passed to the run function so I could later use them in other functions that would be called from the form according to options selected in that form. I tried to add private storage variables inside the class itself, but I don't know the constructors for the types to make a valid copy (after run finishes the private variables don't work).
Can only one module be used at a time, or is it possible to spawn a module and have it be an "info box" while other modules are free to be "run"? That's kinda what I'm getting at, I'd like to keep the connection to the memory/version/modulemode/etc stuff while the main program is running but not hog up the program.
Unfortunately, this is me learning C# at the same time as learning windows gui stuff. I've tried a little google searching and came up with mostly web development--so any links to useful examples/tutorials/refs would be awesome. As soon as I get to the bookstore, I'll see how the pricing on books for C# are :)--Corc 18:39, 12 May 2008 (EDT)
- Currently Tweak is not designed for having multiple modules running at once, since most of them currently suspend the game while it does its work to prevent conflicts. As for your form issues -- instantiate your main form in the Run function, and use form.ShowDialog() (something like that), this is how I do it. —Rick 04:30, 13 May 2008 (EDT)
- Ah, maybe Show() and ShowDialog() behave differently, because I was setting it all up and the form would show up and I could do non-memory editing stuff. Thanks for the quick answer :) --Corc 14:30, 13 May 2008 (EDT)
addresses[edit]
Is there a reference for the addresses available? Or how do I find the addresses? "map_data", "creature_body_part_health_vector_offset" ? I will compile a list if I can find them. --M2775 07:07, 28 May 2008 (EDT)
- There are xml files in a separate folder (for tweak itself) where you are able to define things for different versions of the game. It's best to check if the variable is available before using it though. Almost all the basic useful addresses and offsets are included in those files. --Corc 12:55, 28 May 2008 (EDT)
I'm doing something wrong here...[edit]
I'm trying to get the pointer to the data for the tile that is currently highlighted, like Tile Edit does. Here's what I have, but I must be doing something wrong.
UInt32 mapx, mapy, mapz, mapxoffset, mapyoffset, mapzoffset; mapx = memory.ReadU32(version.GetAddress("mouse_x")); mapy = memory.ReadU32(version.GetAddress("mouse_y")); mapz = memory.ReadU32(version.GetAddress("mouse_z")); mapxoffset = mapx * 4; mapyoffset = mapy * 4; mapzoffset = mapz * 4; UInt32 MouseMapOffset; MouseMapOffset = memory.ReadU32(memory.ReadU32(memory.ReadU32(version.GetAddress("map_data")+mapxoffset)+mapyoffset)+mapzoffset);
I've expanded it to figure out the problem as best I was able, and the first ReadU32 returns a pointer like it should, but the second one returns a value way too low to be correct (0x0013####) and when it reads that it ends up with a pointer way too high (0xD0######). It's stumped me for the past 6 hours, so I turn to people more experienced than me in hopes of some help :) →Valarnin 21:34, 17 July 2008 (EDT)
- From Tile Edit's source,
UInt32 map, xcount, ycount, zcount; map = memory.ReadU32(version.GetAddress("map_data")); if (map == 0) { MessageBox.Show("Map data is not yet available!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } UInt32 mousex, mousey, mousez; mousex = memory.ReadU32(version.GetAddress("mouse_x")); mousey = memory.ReadU32(version.GetAddress("mouse_y")); mousez = memory.ReadU32(version.GetAddress("mouse_z")); if (mousex == 0xFFFF8AD0) { MessageBox.Show("Please press 'k' to choose a tile.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (memory.Suspend() == false) { memory.Resume(); MessageBox.Show("Failed to suspend process.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } xcount = memory.ReadU32(version.GetAddress("map_x_count")); ycount = memory.ReadU32(version.GetAddress("map_y_count")); zcount = memory.ReadU32(version.GetAddress("map_z_count")); UInt32 block = memory.GetTileBlockAddress(map, xcount, ycount, zcount, mousex, mousey, mousez);
- Hope that helps. —Rick 05:17, 18 July 2008 (EDT)
- Thanks, Rick, that was exactly what I needed. I don't know How I missed that function. I can only blame lack of sleep. →Valarnin 11:47, 18 July 2008 (EDT)