Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 347 348 [349] 350 351 ... 360

Author Topic: DFHack 0.43.03-r1  (Read 1122807 times)

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #5220 on: February 23, 2017, 10:47:10 am »

There doesn't seem to be much documentation for the script module (actually gui.script). There are some examples in these scripts, though:

add-thought
gui/advfort
gui/advfort_items
gui/create-item

(note that the advfort ones refer to it as "gscript", and the others use "script")
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.43.03-r1
« Reply #5221 on: February 23, 2017, 12:01:12 pm »

The script API allows that with script.sleep

Perfect!

EDIT: Just for clarification, will all variables that were defined still be defined?
« Last Edit: February 23, 2017, 12:12:28 pm by Roses »
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #5222 on: February 23, 2017, 02:40:57 pm »

Yes. It essentially suspends the current function (although it has to be wrapped with script.start).
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.43.03-r1
« Reply #5223 on: February 23, 2017, 02:47:56 pm »

Yes. It essentially suspends the current function (although it has to be wrapped with script.start).

Good to know, so basically I have a large mess of code and I can just put
Code: [Select]
script.start(function ()at the beginning of it and close it out with a
Code: [Select]
end)Then put script.sleep inside of it wherever I want to pause the script?

Will other timeout calls and eventful triggers still trigger while it is suspended?

EDIT: Is there a way to force pause/unpause the game from a lua script? Sorry for all the questions, this is all an area I haven't worked with yet.
« Last Edit: February 23, 2017, 03:46:59 pm by Roses »
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #5224 on: February 23, 2017, 05:56:26 pm »

That should work, yes. Timeouts and eventful triggers shouldn't be inside of the function you're passing to script.start(), so those should still work (and even if they were declared inside of script.start(), it should work, since you'd be registering functions).

Pausing can be done by changing df.global.pause_state.
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.

McNoodlehead

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #5225 on: February 23, 2017, 07:56:51 pm »

Is there a way to get the size of a procedural genned creature with DFHack? I'm trying to figure out the size of a wererhino, but since they're procedural and don't have raws, I don't know whether they can fit into rhinoman fitted armor or not.
Logged
You bumbled your way into what some people consider winning the game.
My guess is he drew a mushroom on a throne and shoved it in their faces again and again, and kept slapping anyone who looked like they disagree.

TheFlame52

  • Bay Watcher
  • Certified geezer & only man to win 0.40.24
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #5226 on: February 23, 2017, 08:32:29 pm »

'gui/gm-editor df.global.world.raws' will get you into your world's raws. Then hit creatures > alphabetical and look for w, then wererhino. At the bottom of the menu there should be an option called 'raws'. That will give you a huge list of unlabeled strings. I found the size of a werebeaver on line 73, so it should be around there somewhere. The last number on that line is the size of your creature. Compare that to the list of creatures by adult size to find an animal man close to that size.

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #5227 on: February 23, 2017, 09:40:09 pm »

Way harder than it needs to be, just target yourself and run gui/gm-editor then go down to body in the raws for a weremonitor I just checked it's adultsize 8100, while body.blood_max is 8100, as is body.size_info.size_base, while size_cur on this one is 9617. Just add a zero to get the value on the wiki lists, sperm whale man I checked was 1,181,315 while wiki lists 12,535,000 as max, so a weremonitor can wear the same armor as a kangaroo man, find your blood_max and size_cur as a wererhino and add a 0 then check the wiki list.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #5228 on: February 24, 2017, 05:12:53 am »

(note that the advfort ones refer to it as "gscript", and the others use "script")

Oof. That's because I didn't know advfort or advfort-items used it when I wrote the other two, so I just sort of went at it freshly instead of following existing convention.

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #5229 on: February 24, 2017, 06:50:32 am »

(note that the advfort ones refer to it as "gscript", and the others use "script")

Oof. That's because I didn't know advfort or advfort-items used it when I wrote the other two, so I just sort of went at it freshly instead of following existing convention.
Also i'm pretty sure both of them are using it incorrectly or superfluously. As each time i understand how it works i somehow manage to confuse myself into not understanding it anymore.

This reminded me that we (I) need some "script" dialogs that would let e.g. choose X units, Y items and then run "some command X Y". That would allow to have a more flexible and user friendly interface for some more used stuff.

TheFlame52

  • Bay Watcher
  • Certified geezer & only man to win 0.40.24
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #5230 on: February 24, 2017, 09:21:58 am »

Way harder than it needs to be, just target yourself and run gui/gm-editor then go down to body in the raws for a weremonitor I just checked it's adultsize 8100, while body.blood_max is 8100, as is body.size_info.size_base, while size_cur on this one is 9617. Just add a zero to get the value on the wiki lists, sperm whale man I checked was 1,181,315 while wiki lists 12,535,000 as max, so a weremonitor can wear the same armor as a kangaroo man, find your blood_max and size_cur as a wererhino and add a 0 then check the wiki list.
I did not know that's how those numbers worked.

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #5231 on: February 24, 2017, 09:42:02 am »

Oof. That's because I didn't know advfort or advfort-items used it when I wrote the other two, so I just sort of went at it freshly instead of following existing convention.
There's already some inconsistency between things like dlg/dialog, script/gscript/guiScript, etc. between scripts (turns out gui/gm-editor and gui/gm-unit use "guiScript"). As long as you stay consistent within a script, it's fine.


This reminded me that we (I) need some "script" dialogs that would let e.g. choose X units, Y items and then run "some command X Y". That would allow to have a more flexible and user friendly interface for some more used stuff.
Are you talking about adding stuff to the Lua libraries (e.g. library/lua/gui/script.lua) or adding scripts that wrap certain commands?
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.

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #5232 on: February 24, 2017, 09:49:28 am »

Are you talking about adding stuff to the Lua libraries (e.g. library/lua/gui/script.lua) or adding scripts that wrap certain commands?

Ideally both. It would be like other dialog-things but then the script that wraps any other script that uses a unit/item/pos as variable would be trivial.

soul4hdwn

  • Bay Watcher
  • make due with what you have
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #5233 on: February 24, 2017, 11:11:13 am »

edit: sorry there was deeper help menu explaining questions...
« Last Edit: February 24, 2017, 11:13:29 am by soul4hdwn »
Logged

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.43.03-r1
« Reply #5234 on: February 25, 2017, 12:33:06 am »

Way harder than it needs to be, just target yourself and run gui/gm-editor then go down to body in the raws for a weremonitor I just checked it's adultsize 8100, while body.blood_max is 8100, as is body.size_info.size_base, while size_cur on this one is 9617. Just add a zero to get the value on the wiki lists, sperm whale man I checked was 1,181,315 while wiki lists 12,535,000 as max, so a weremonitor can wear the same armor as a kangaroo man, find your blood_max and size_cur as a wererhino and add a 0 then check the wiki list.
I did not know that's how those numbers worked.
Yeah, I could imagine there might be a case where blood_max wasn't accurate, but size_base should always be the critter size and I don't know if it possible to have size_cur so different you can't wear the same armor anymore.
Logged
Pages: 1 ... 347 348 [349] 350 351 ... 360