Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 3 [4] 5 6 ... 11

Author Topic: M.O.U.S.E Fortress - Old Thread, see New Thread  (Read 63119 times)

Shukaro

  • Bay Watcher
    • View Profile
Re: M.O.U.S.E Fortress v1.0.4 - Click your way to Fun!
« Reply #45 on: August 01, 2010, 11:08:00 am »

All you need to do if you use a custom tileset is move the existing image files to the vanilla folder and the ones in the folder with your tileset's name into the main folder, where the vanilla ones used to be. If the game isn't zoomed, it should work. I made sure to test each of the sets of images before uploading them, so they should work. (Providing the tiles in the version you're using are the same as what I used (the latest) and there aren't any weird things going on in your install)
Logged
Urist McHauler Cancels Give Food: Patient Insane
------------------------------------------------------------------
Mouse Fortress | Custom Menu and Hotkey Framework
Dwarven Higher Learning Mod | Alternative Skill Training

NRN_R_Sumo1

  • Bay Watcher
    • View Profile
Re: M.O.U.S.E Fortress v1.0.4 - Click your way to Fun!
« Reply #46 on: August 01, 2010, 02:42:36 pm »

toying around with zoom options and it still doesnt seem to want to "follow my cursor"

I should mention that purplex.png is a 16x14 instead of 16x16 I suspect that it might not be the issue, but just incase it is.

the pheobus build I'm using to test this is the newest and empty of mods currently.

edit: Wait, I'm using a widescreen monitor, if this is trying to function through some sort of video capture technique would that be enough to set it off? even though I can see nothing differant in the images?
« Last Edit: August 01, 2010, 02:44:23 pm by NRN_R_Sumo1 »
Logged
A dwarf is nothing but an alcohol powered beard.

Shukaro

  • Bay Watcher
    • View Profile
Re: M.O.U.S.E Fortress v1.0.4 - Click your way to Fun!
« Reply #47 on: August 01, 2010, 03:10:17 pm »

Ok, when you select Look Around, does the cursor move at all? If you left click and drag does it move? It shouldn't matter if your screen is widescreen, only what tiles are being displayed. Also, it would help if you selected look around, wait a few seconds, then pause the script, double click the AHK icon, and under view, click on Variable and Their Contents and Lines most Recently executed and paste the contents of those two screens here. Do you have another computer? If so, try using the latest Phoebus set and the script on it. Maybe it has something to do with your computer's working environment.
Logged
Urist McHauler Cancels Give Food: Patient Insane
------------------------------------------------------------------
Mouse Fortress | Custom Menu and Hotkey Framework
Dwarven Higher Learning Mod | Alternative Skill Training

profit

  • Bay Watcher
  • Finely Crafted Engravings... Or it didn't happen.
    • View Profile
Re: M.O.U.S.E Fortress v1.0.4 - Click your way to Fun!
« Reply #48 on: August 01, 2010, 03:27:09 pm »

Hey there. I have memory read functions which you may find useful.

I have been using them in order to get floating point and integer values from a game I have been automating, but I am sure you can also use it.

I make a directory called lib under AHK and toss these in there as .ahk files of their function and I can use them in all my scripts *Does require AHK to be ran as administrator on windows 7 unless AUC is off in order to work*

Code: [Select]
ReadMemory(MADDRESS,PROGRAM)
{
winget, pid, PID, %PROGRAM%
VarSetCapacity(MVALUE,4,0)
ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt")
DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"Str",MVALUE,"UInt",4,"UInt *",0)

Loop 4
result += *(&MVALUE + A_Index-1) << 8*(A_Index-1)


return, result 
}

Code: [Select]
ReadMemoryFloat(MADDRESS,PROGRAM)
{
winget, pid, PID, %PROGRAM%
VarSetCapacity(MVALUE,4,0)
ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt")
DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"Str",MVALUE,"UInt",4,"UInt *",0)

FP := NumGet(&MVALUE,0,"float")

return, FP 
}

I hope they help you, for me I find them invaluable.

Here is an example of the code I use them in:
Code: [Select]
valueX:=ReadMemoryFloat(0x00724560,"Censored")
valueY:=ReadMemoryFloat(0x00724564,"Censored")
valueZ:=ReadMemoryFloat(0x00724568,"Censored")
valueSteps:=ReadMemoryFloat(0x0072456C,"Censored")
valueDirection:=ReadMemory(0x0072455C,"Censored")

Logged
Mods and the best utilities for dwarf fortress
Community Mods and utilities thread.

Shukaro

  • Bay Watcher
    • View Profile
Re: M.O.U.S.E Fortress v1.0.4 - Click your way to Fun!
« Reply #49 on: August 01, 2010, 04:54:01 pm »

That, is very nice. I'll be sure to try those out and see it I can find some applications for them. Thanks!
Logged
Urist McHauler Cancels Give Food: Patient Insane
------------------------------------------------------------------
Mouse Fortress | Custom Menu and Hotkey Framework
Dwarven Higher Learning Mod | Alternative Skill Training

NRN_R_Sumo1

  • Bay Watcher
    • View Profile
Re: M.O.U.S.E Fortress v1.0.4 - Click your way to Fun!
« Reply #50 on: August 01, 2010, 07:32:24 pm »

I can click and drag until I try using Look around from your right click menu. (it actually seems to lock up the script, but if I use the default K in DF I can seem to roughly drag the X around by using the click and drag control which uses the arrow keys.)
The X not following the mouse is what I've been trying to get to work, so no it doesnt work for me.  ;D
Code: [Select]
Local Variables for Cursorfollow()
--------------------------------------------------


Global Variables (alphabetical)
--------------------------------------------------
0[1 of 3]: 0
breaker[1 of 3]: 0
cxpos[0 of 0]: 
cypos[0 of 0]: 
ErrorLevel[1 of 3]: 1
ixpos[3 of 3]: 434
iypos[3 of 3]: 464
mxpos[3 of 3]: 508
mypos[4 of 7]: 1056
needback[1 of 3]: 1
rstate[0 of 0]: 
state[1 of 3]: U
title[64 of 259]: C:\DFG\Mouse Fortress\Mouse Fortress.ahk - AutoHotkey v1.0.4...
uxpos[2 of 3]: 53
uypos[3 of 3]: 470
xpos[0 of 0]: 
xposb[0 of 0]: 
xtemp[4 of 7]: 1696
ypos[0 of 0]: 
yposb[0 of 0]: 
ytemp[4 of 7]: 1026
Logged
A dwarf is nothing but an alcohol powered beard.

Shukaro

  • Bay Watcher
    • View Profile
Re: M.O.U.S.E Fortress v1.0.4 - Click your way to Fun!
« Reply #51 on: August 01, 2010, 08:34:06 pm »

Ok, it's setting the errorlevel to 1 for imagesearch. That means that for some reason, it's failing to find the pictures of the cursors on the screen. Could you capture a screenshot of DF (.png format or some other high-quality format, alt-printscreen takes a picture of the active window) while the cursor is up and pass me a link so I can see how the images are different?
Logged
Urist McHauler Cancels Give Food: Patient Insane
------------------------------------------------------------------
Mouse Fortress | Custom Menu and Hotkey Framework
Dwarven Higher Learning Mod | Alternative Skill Training

Creamcorn

  • Bay Watcher
  • [FANCIFUL]
    • View Profile
Re: M.O.U.S.E Fortress v1.0.4 - Click your way to Fun!
« Reply #52 on: August 01, 2010, 08:52:28 pm »

Following this, while I am an avid user of the keyboard interface, this will be good to bring up to new players.
Logged
"OH NO! That carp is gulping at me menacingly, even though it cannot really threaten me from here on land!  I KNOW! I'll dodge into the water, where I'll be safe!"

Shukaro

  • Bay Watcher
    • View Profile
Re: M.O.U.S.E Fortress v1.0.4 - Click your way to Fun!
« Reply #53 on: August 01, 2010, 09:51:49 pm »

Yeah, it's quite a bit more intuitive than the standard UI. Right now it's in an early state, but I'm adding more feature over time. The problem is, every time I code in a new feature, it seems that some intractable problem crops up. Several hours of banging my fists on my keyboard later, I realize I just have to change one line, and the whole thing works flawlessly.
Logged
Urist McHauler Cancels Give Food: Patient Insane
------------------------------------------------------------------
Mouse Fortress | Custom Menu and Hotkey Framework
Dwarven Higher Learning Mod | Alternative Skill Training

profit

  • Bay Watcher
  • Finely Crafted Engravings... Or it didn't happen.
    • View Profile
Re: M.O.U.S.E Fortress v1.0.4 - Click your way to Fun!
« Reply #54 on: August 01, 2010, 09:52:28 pm »

Ok, it's setting the errorlevel to 1 for imagesearch. That means that for some reason, it's failing to find the pictures of the cursors on the screen. Could you capture a screenshot of DF (.png format or some other high-quality format, alt-printscreen takes a picture of the active window) while the cursor is up and pass me a link so I can see how the images are different?
I have serious problems getting imagesearch to work with games.

Anything that uses the graphics cards overlay really seems to cause havoc. 

Meaning imagesearch would probably work in 2d mode and some sdl modes, but probably not all.

pixelget when in the slow mode does fine.

« Last Edit: August 01, 2010, 09:56:54 pm by profit »
Logged
Mods and the best utilities for dwarf fortress
Community Mods and utilities thread.

profit

  • Bay Watcher
  • Finely Crafted Engravings... Or it didn't happen.
    • View Profile
Re: M.O.U.S.E Fortress v1.0.4 - Click your way to Fun!
« Reply #55 on: August 01, 2010, 10:24:15 pm »

Oh just because you were looking for them before I know, Here is where dwarf fortress stores the X component of what XY screen tile the mouse is on.   IE 1 = complete left 80 = complete right when all the way zoomed in.

      0x0227A71C

Fiancee is wanting to talk so I cant get the Y right now, but I am betting it is just 4bytes up or down from there.
But...
DFMouseValueX := ReadMemory(0x0227A71C,"Dwarf Fortress")
 Should pull that value you have been looking for  on the SDL version of 0.31.10  Dont happen to have 31.12 running at the moment.
Logged
Mods and the best utilities for dwarf fortress
Community Mods and utilities thread.

profit

  • Bay Watcher
  • Finely Crafted Engravings... Or it didn't happen.
    • View Profile
Re: M.O.U.S.E Fortress v1.0.4 - Click your way to Fun!
« Reply #56 on: August 01, 2010, 11:32:58 pm »

Here is 31.12's SDL values
     X is at 0x02811734
     Y is at 0x02811738



Logged
Mods and the best utilities for dwarf fortress
Community Mods and utilities thread.

profit

  • Bay Watcher
  • Finely Crafted Engravings... Or it didn't happen.
    • View Profile
Re: M.O.U.S.E Fortress v1.0.4 - Click your way to Fun!
« Reply #57 on: August 01, 2010, 11:44:04 pm »

A special gift for you.... Took me like 10 mins.. and I didn't delete everything from where I took it from since I have just gotten done using this code elsewhere.

Remember you need to put my two memory read functions in ahk files in a lib directory under AHK if you want this script to work.

Dwarf fortress disables the mouse above certain zoom levels as well. be aware.
( works with 31.12 SDL windows)
Code: [Select]
#d::
value := 0x00000000000
Gui, Add, Text, vMyText, X = xxxsadasdasdasdasdadsa.`n`n`n`n`n`n`n`n`n`n  (censored)
gui, show
gui +AlwaysOnTop
loop
{ ;read Memory and Display XYZ LOOP.

; Mouse Information
MouseGetPos, MouseXpos, MouseYpos
; Memory Reads

DFMouseValueX:=ReadMemory(0x02811734,"Dwarf Fortress")
DFMouseValueY:=ReadMemory(0x02811738,"Dwarf Fortress")
if (DFMouseValueX > 4000000000)
{
DFMouseValueX = Mouse is off Dwarf fortress window
DFMouseValueY = Mouse is off Dwarf fortress window
}
;msgbox %valuex%

GuiControl,, MyText, DFMouseValueX = %DFMouseValueX% `nDFMouseValueY = %DFMouseValueY% `nZ = %valuez% `nSteps = %valuesteps% `nDirection = %valueDirection% `nMouse X = %MouseXpos% `nMouse Y = %MouseYpos% `n (censored)
sleep 50
}

return

Simply have DF running and press windowskey D

*edit* Just looked and DF only tracks the mouse from X= 0 To 80 and Y= 0 To 25 for some reason.  anything out of that and DF ignores the mouse entirely.

*edit* That also happens to be the standard size window on the default zoom level.  80 chars across and 25 down.

*edit* never mind, those address locations wander inside DF, depending on the size of the map you have and probably how many entities and the like... Most games they stay kinda still but df must have them after certain other data is loaded.   When I tried a different map that was a different size I was not getting the correct data any longer.  It had jumped to 0x027A1734 and 0x027A1738.

I am 100% certain chmod would be able to tell us what to do about them wandering around in memory since he reads out things in DT.

Until then if you want to make it work to see it go.. use cheat engine and hook to DF, move your mouse to the first tile on the left and alt tab to cheat engine and search for 1 in memory, then move a square to the right and search for 2 and so on until you are down to one address.
(use shift+tab to move back onto the first scan button without moving the mouse after alt+tabbing to cheat engine) add 4 hex to the number to get the Y coordinate. IE if your X was at 0x027A1738 then your Y would be at 0x027A173C
« Last Edit: August 02, 2010, 12:12:47 am by profit »
Logged
Mods and the best utilities for dwarf fortress
Community Mods and utilities thread.

Shukaro

  • Bay Watcher
    • View Profile
Re: M.O.U.S.E Fortress v1.0.4 - Click your way to Fun!
« Reply #58 on: August 02, 2010, 12:51:43 pm »

Now, if only I could figure out if DF stores the coordinates of the game cursor, I'd be able to slim down the functions considerably. Thanks for all the help Profit! Memory reading is a whole lot more reliable than other methods.

Edit: Aha, success! Prepare to be optimized, functions.

Edit: Hmm, cursor coordinates are relative to the world, bummer. I'll keep looking into it though, as I continue work on the next version.
« Last Edit: August 02, 2010, 02:01:00 pm by Shukaro »
Logged
Urist McHauler Cancels Give Food: Patient Insane
------------------------------------------------------------------
Mouse Fortress | Custom Menu and Hotkey Framework
Dwarven Higher Learning Mod | Alternative Skill Training

profit

  • Bay Watcher
  • Finely Crafted Engravings... Or it didn't happen.
    • View Profile
Re: M.O.U.S.E Fortress v1.0.4 - Click your way to Fun!
« Reply #59 on: August 02, 2010, 06:33:29 pm »

Yeah, I was saddened as well. I assume the memory.xml files that float around would tell me how to deal with it if I sad down and deciphered them..
Logged
Mods and the best utilities for dwarf fortress
Community Mods and utilities thread.
Pages: 1 2 3 [4] 5 6 ... 11