Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 122 123 [124] 125 126 ... 243

Author Topic: DFHack 50.12-r3  (Read 807626 times)

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1845 on: August 27, 2019, 09:08:54 pm »

"Are you trying to display some data that a separate script is generating in a widget?" Yes, exactly.

Tried script_environment on a dummy script (also tried reqscript now; same result) and dwarfmoniter alike, adding/editing variables in during runtime, didn't work even with disable-enable or by editing variables from console before enabling dwarfmonitor for first time in current process. It looks like the environment dwarfmonitor generates and the environment console generates are different. (Adding something to BASE_G obviously failed too; wildly speculating might be that they're on separate C lua states).
They are! Yeah, that might cause some issues. That's almost certainly why dfhack.timeout and persistent storage aren't available, as you mentioned - widgets haven't needed those, and running Lua code from DF's render() as the widgets do can sometimes break in weird ways, which I think is why I isolated it by using a separate Lua state.

I feel like reqscript and script_environment ought to work, but I could be wrong (and can't say I've tested it). One thing that trips people up: those only give you access to the global state from the last time the script was run, so calling them more than once won't re-run the script in question (only running the script from the console will do that). But if you're already aware of that, and aren't seeing things populated on the dwarfmonitor side after running the script and accessing its environment again, then it probably is related to the separate Lua state as you suggested.

Now that I think about it, passing data between Lua states might not be easy without going through C++, since they have separate Lua stacks and may be getting accessed from different threads.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1846 on: August 28, 2019, 12:43:40 am »

Yeah, they don't work for sharing data (but thanks for warning about having script modify its values on repeated running, I previously modified the values directly by editing the environment instead and checking that sticking with :lua console).

The render does have access to, say, df.global, so there's probably way to share at least plaintext values, if not objects. But it looks like that would have to be written from ground up (or be a rewrite of persistent data storage; not sure in which file the code for that is). Provided that wouldn't be itself a thing that breaks things in weird ways, I guess.
« Last Edit: August 28, 2019, 12:46:21 am by Fleeting Frames »
Logged

strainer

  • Bay Watcher
  • Goatherd
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1847 on: August 29, 2019, 09:47:57 am »

After a bit of curious scanning, I couldn't find in dfhack.lua any way a script can get run without having a reference to its `env` stored in dfhack.lua's local `scripts` table which records when scripts where last run, their `env` (a reference to their local meta-table (?)) and other things. It looks as though env references have to be working in order for the module system to be working (by sharing script state through them)
Since it seems all handled within dfhack.lua, some logging about the `scripts` tables updates might reveal why its not sharing scripts `env` as expected.
Logged
Klok the Kloker !

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1848 on: August 29, 2019, 03:57:42 pm »

After a bit of curious scanning, I couldn't find in dfhack.lua any way a script can get run without having a reference to its `env` stored in dfhack.lua's local `scripts` table which records when scripts where last run, their `env` (a reference to their local meta-table (?)) and other things. It looks as though env references have to be working in order for the module system to be working (by sharing script state through them)
Since it seems all handled within dfhack.lua, some logging about the `scripts` tables updates might reveal why its not sharing scripts `env` as expected.

Well... There is other way to run lua. In this case it's being run from plugin code. For some reason it's creating a new (totally new everything) lua_state which is not recommended. I've talked with Lethosor in IRC and IMHO it's a bug. I recall having doing the same thing when somebody smarter told me that i've needed locks in some places. My thinking is like this:
  • either this needs a new lua state, but then you CAN NOT access DF and you happily run in your thread (think math calculations)
  • or you need access to DF so there is no reason why would you not share everything with the rest of lua (in this case environment variables and stuff)

Disclaimer: i've been away from this for a looong time so i might be very wrong.

strainer

  • Bay Watcher
  • Goatherd
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1849 on: August 29, 2019, 07:37:38 pm »

Thanks, I missed Lethosor's link to dwarfmonitor.cpp and that it sets up its own lua state. I guess if dm and maybe others are initializing lua state themselves then it would be best behaviour if they could pass the reference to dfhack.lua so it can put it in the `scripts` table it manages.
« Last Edit: August 29, 2019, 07:39:12 pm by strainer »
Logged
Klok the Kloker !

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: DFHack 0.44.12-r2
« Reply #1850 on: September 04, 2019, 05:42:13 am »

Quick question: The use of this create-unit line sometimes crashes the game, sometimes it works. Any idea why?

Code: [Select]
modtools/reaction-trigger -reactionName SUMMON_CRUNDLE_MALE -command [ modtools/create-unit -race CRUNDLE -caste MALE -setUnitToFort -location [ \\LOCATION ] -age 1 ]
I tried searching through the thread, but found not much, besides this post: http://www.bay12forums.com/smf/index.php?topic=164123.msg8003175;topicseen#msg8003175
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

VictorAB

  • Escaped Lunatic
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1851 on: September 17, 2019, 05:00:46 am »

When trying to run the scripts "adv-max-skills" or "make-legendary" I just get the error message "Error loading script"
Is the scripts old and need an update to work right again?

Image to show what I did...
https://gyazo.com/bd4e3048fc3f4ce2e839b925d751457d

(I don't know how to "upload" images to this site, so i use Gyazo... sorry for that mild inconvenience)

EDIT: Forgot to mention that i use Meph's Tileset x32 v5.4 found here: http://www.bay12forums.com/smf/index.php?topic=161047.0
The Tileset comes with it's own launcher and DFHack and all... But i'm sure you guys know that by now :P
« Last Edit: September 17, 2019, 05:06:07 am by VictorAB »
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1852 on: September 17, 2019, 05:14:57 am »

When trying to run the scripts "adv-max-skills" or "make-legendary" I just get the error message "Error loading script"
Is the scripts old and need an update to work right again?

Image to show what I did...
https://gyazo.com/bd4e3048fc3f4ce2e839b925d751457d

(I don't know how to "upload" images to this site, so i use Gyazo... sorry for that mild inconvenience)

EDIT: Forgot to mention that i use Meph's Tileset x32 v5.4 found here: http://www.bay12forums.com/smf/index.php?topic=161047.0
The Tileset comes with it's own launcher and DFHack and all... But i'm sure you guys know that by now :P

You don't need to write "script" before scriptname. It's enough to write "adv-max-skills" and "make-legendary" and it automagically figures out you mean you want to run script named "adv-max-skills.lua" (or .rb or etc...)

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1853 on: September 17, 2019, 12:28:12 pm »

Quick question: The use of this create-unit line sometimes crashes the game, sometimes it works. Any idea why?

Code: [Select]
modtools/reaction-trigger -reactionName SUMMON_CRUNDLE_MALE -command [ modtools/create-unit -race CRUNDLE -caste MALE -setUnitToFort -location [ \\LOCATION ] -age 1 ]
I tried searching through the thread, but found not much, besides this post: http://www.bay12forums.com/smf/index.php?topic=164123.msg8003175;topicseen#msg8003175

I don't suppose there is any error log printed? Do any of your other create-unit uses do this as well?
Logged

VictorAB

  • Escaped Lunatic
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1854 on: September 17, 2019, 04:34:40 pm »

When trying to run the scripts "adv-max-skills" or "make-legendary" I just get the error message "Error loading script"
Is the scripts old and need an update to work right again?

Image to show what I did...
https://gyazo.com/bd4e3048fc3f4ce2e839b925d751457d

(I don't know how to "upload" images to this site, so i use Gyazo... sorry for that mild inconvenience)

EDIT: Forgot to mention that i use Meph's Tileset x32 v5.4 found here: http://www.bay12forums.com/smf/index.php?topic=161047.0
The Tileset comes with it's own launcher and DFHack and all... But i'm sure you guys know that by now :P

You don't need to write "script" before scriptname. It's enough to write "adv-max-skills" and "make-legendary" and it automagically figures out you mean you want to run script named "adv-max-skills.lua" (or .rb or etc...)
Ah i see, just tried as of typing this.
The way i understand it:
If i type "script adv-max-skills" DFHack actually reads it as "script script adv-max-skills" well, it's a theory any ways since it fails when i type the command initially.

But yeah, without the word "script" in front, it works just fine :D

Thanks, never would have occurred to me to omit "script".
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1855 on: September 17, 2019, 05:13:47 pm »

Actually, "script" is its own command that tries to read DFHack commands from the file you give it. It's not a prefix that's getting dropped, and DFHack is never using "script script" for anything internally. It's just a command that happens to be named "script", just like there's a command named "adv-max-skills".

Out of curiosity, why did you try putting "script" in front? Was there a documentation page that led you to try that? I'd like to clear up any future confusion, if possible.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Bainin

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1856 on: September 19, 2019, 01:29:25 pm »

I got a bit of a Problem, i wanted to play again after a long time then i noticed that DFHack window is not starting. i was confused tried restarting checked my lazy newb pack and it says it is enabled and if i disable Dfhack it says it can't run stuff if i do that, the window is gone and in the start screen there is no dfhack version in the corner.
Strange thing is i have the same issue when i start up a super old version of DF the DFhack just won't start ctrl shift P does not make it appear either But then i tested another Old save and there it works.
when i try and run DFhackrun it instantly closes.  Also the stdout and stderr have like nothing in them.
Can anyone help me with this?

truly weirdest thing to me is that the DFHack 0.43.03-r1 runs when i start that version but the latest (0.44.12) and 0.44.02 don't run smh.

only message stderr is this:
Running PyLNP 0.13b (OS: win, Compiled: True)
INFO: Read installed graphics (Phoebus) from log
INFO: Rebuilding .\Dwarf Fortress 0.44.12\dfhack_PyLNP.init with the enabled hacks
INFO: Rebuilding .\Dwarf Fortress 0.44.12\onMapLoad_PyLNP.init with the enabled hacks
INFO: Rebuilding .\Dwarf Fortress 0.44.12\onMapLoad_PyLNP.init with the enabled hacks
INFO: Rebuilding .\Dwarf Fortress 0.44.12\dfhack_PyLNP.init with the enabled hacks
INFO: Rebuilding .\Dwarf Fortress 0.44.12\dfhack_PyLNP.init with the enabled hacks
INFO: Rebuilding .\Dwarf Fortress 0.44.12\dfhack_PyLNP.init with the enabled hacks
INFO: Rebuilding .\Dwarf Fortress 0.44.12\onMapLoad_PyLNP.init with the enabled hacks
INFO: Rebuilding .\Dwarf Fortress 0.44.12\onMapLoad_PyLNP.init with the enabled hacks
INFO: Rebuilding .\Dwarf Fortress 0.44.12\dfhack_PyLNP.init with the enabled hacks
INFO: F:\Games\DWARFF~1\201919~1.09\Dwarf Fortress 0.44.12\Dwarf Fortress.exe is already running
INFO: F:\Games\DWARFF~1\201919~1.09\Dwarf Fortress 0.44.12\Dwarf Fortress.exe is already running
INFO: F:\Games\DWARFF~1\201919~1.09\Dwarf Fortress 0.44.12\Dwarf Fortress.exe is already running
INFO: F:\Games\DWARFF~1\201919~1.09\Dwarf Fortress 0.44.12\Dwarf Fortress.exe is already running
INFO: F:\Games\DWARFF~1\201919~1.09\Dwarf Fortress 0.44.12\Dwarf Fortress.exe is already running
INFO: F:\Games\DWARFF~1\201919~1.09\Dwarf Fortress 0.44.12\Dwarf Fortress.exe is already running
INFO: F:\Games\DWARFF~1\201919~1.09\Dwarf Fortress 0.44.12\Dwarf Fortress.exe is already running
INFO: Rebuilding .\Dwarf Fortress 0.44.12\onMapLoad_PyLNP.init with the enabled hacks
INFO: Rebuilding .\Dwarf Fortress 0.44.12\onMapLoad_PyLNP.init with the enabled hacks
INFO: Rebuilding .\Dwarf Fortress 0.44.12\dfhack_PyLNP.init with the enabled hacks
INFO: Rebuilding .\Dwarf Fortress 0.44.12\dfhack_PyLNP.init with the enabled hacks
INFO: Rebuilding .\Dwarf Fortress 0.44.12\dfhack_PyLNP.init with the enabled hacks
« Last Edit: September 19, 2019, 01:52:12 pm by Bainin »
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1857 on: September 19, 2019, 03:57:53 pm »

Judging by the reports in the LNP thread, there's something wrong with the latest version: The second latest version ought to be a very good alternative until the issue has been sorted out.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1858 on: September 19, 2019, 04:04:27 pm »

Yes, see http://www.bay12forums.com/smf/index.php?topic=126076.msg8025916#msg8025916. I might have time to look at it, but it sounds like DFHack was bundled in that pack incorrectly, which is not something we can fix ourselves.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1859 on: September 24, 2019, 09:38:27 am »

Is anyone doing any work on the persist-table module (allowing numbers to be stored instead of just strings, changing how it works, etc...)? I am working on completely re-writing my stuff and it heavily uses the persistent stuff, just wanted to make sure any work I do isn't going to be invalidated or pointless based on someone elses work
Logged
Pages: 1 ... 122 123 [124] 125 126 ... 243