Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 108 109 [110] 111 112

Author Topic: DFHack 0.44.12-r2  (Read 135374 times)

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1635 on: February 15, 2019, 11:55:06 pm »

Trying to use the onBuildingCreatedDestroyed eventful trigger, it worked in the past when I tested it, but now, instead of returning the buliding_id it seems to just be returning a random number, a different number in each world I've generated, but the same number every time. I've reloaded the eventful plugin several times and even tried completely closing DF and reopening and starting a new world, but nothing seems to help.

This is the eventful code, fairly simple but not working.
Code: [Select]
eventful.enableEvent(eventful.eventType.BUILDING, 10)
eventful.onBuildingCreatedDestroyed.buildingTrigger = function(buildingID)
 print(buildingID)
 building = df.building.find(buildingID)
 if building then
  checkBuildingCreated(buildingID)
 else
  checkBuildingDestroyed(buildingID)
 end
end
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1636 on: February 16, 2019, 02:31:21 pm »

Not seeing an obvious reason, but I'm not familiar with eventful. What does the 10 argument mean?
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 #1637 on: February 16, 2019, 02:47:42 pm »

The 10 is how often it runs the check. The odd thing is that it is correctly triggering on each building created/destroyed, but it isn't giving the right buildingID, which means I must have royally screwed something up. I just can't figure out what
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1638 on: February 16, 2019, 02:53:59 pm »

If print(buildingID) is printing garbage, that's not your fault. (Can you give an example?) Also, is eventful.eventType.BUILDING equal to 5?
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 #1639 on: February 16, 2019, 03:30:21 pm »

Yeah, the eventType is 5, I've stripped everything else out of the script and just run
Quote
eventful.onBuildingCreatedDestroyed.test = function(a) print('test',a) end
on the command line. Then tried built and destroyed a couple of the default workshops (Leatherworker's and Kitchen) and the Soap Maker's custom workshop, each time it printed 1840249752 when I both created and destroyed the buildings (although in another world I tried this in it was printing a large negative number, so that isn't always the same).
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1640 on: February 18, 2019, 01:25:08 am »

Yeah, the eventType is 5, I've stripped everything else out of the script and just run
Quote
eventful.onBuildingCreatedDestroyed.test = function(a) print('test',a) end
on the command line. Then tried built and destroyed a couple of the default workshops (Leatherworker's and Kitchen) and the Soap Maker's custom workshop, each time it printed 1840249752 when I both created and destroyed the buildings (although in another world I tried this in it was printing a large negative number, so that isn't always the same).

I have no idea how it worked before: this is pointer
And it's used: not a pointer . So you are getting an address of your id.

Also: this is related and this broke it
« Last Edit: February 18, 2019, 05:54:33 am by Warmist »
Logged

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1641 on: February 18, 2019, 12:36:55 pm »

Interesting. So it did used to work, at least sometimes. So I'm not crazy. Is there a way to get the id from the pointer? I suppose I can also just loop over all buildings and see what's new when a building gets created. Or I could link it to the on job completed eventful
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1642 on: February 19, 2019, 02:33:57 am »

Interesting. So it did used to work, at least sometimes. So I'm not crazy. Is there a way to get the id from the pointer? I suppose I can also just loop over all buildings and see what's new when a building gets created. Or I could link it to the on job completed eventful
I suggest using job complete. Or waiting for release with a fix. Also there is a way to get id from the pointer, but i suggest not to think about that because it's very close to summoning chtulian monstrosities from the computational multiverse. (also it would be broken after fix).

Lastly - yes you could just do the same thing plugin does - personally i find all that "iterate over everything every N frames" very ugly and suggest leaving it in one place (i.e. the plugin). It's also a bit finicky to get right, however you probably have very similar systems in place.

Golbolco

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1643 on: February 19, 2019, 04:02:52 pm »

Is it possible to spawn in a wagon using DFhack?
Logged

thefriendlyhacker

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1644 on: February 19, 2019, 04:09:05 pm »

Is it possible to spawn in a wagon using DFhack?
For a lark, I tried spawning one in arena with modtools/create-item. It spawned, but was scuttled a tick later. I doubt fort/adv mode behavior will be any different.
Logged
Fallout Equestria Redux - that's right, it's back

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1645 on: February 20, 2019, 09:13:24 am »

well wagons do seem to work fine in adv mode, but they totally scuttle in Fort mode or fort mode like modes.
that's mostly the Creature wagon though.
Logged
I thought I would I had never hear my daughter's escapades from some boy...
DAMN YOU RUMRUSHER!!!!!!!!
"body swapping and YOU!"
Adventure in baby making!Adv Homes

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1646 on: February 20, 2019, 10:06:17 am »

Interesting. So it did used to work, at least sometimes. So I'm not crazy. Is there a way to get the id from the pointer? I suppose I can also just loop over all buildings and see what's new when a building gets created. Or I could link it to the on job completed eventful
I suggest using job complete. Or waiting for release with a fix. Also there is a way to get id from the pointer, but i suggest not to think about that because it's very close to summoning chtulian monstrosities from the computational multiverse. (also it would be broken after fix).

Lastly - yes you could just do the same thing plugin does - personally i find all that "iterate over everything every N frames" very ugly and suggest leaving it in one place (i.e. the plugin). It's also a bit finicky to get right, however you probably have very similar systems in place.

Combining onJobInitiated (for checking if the building is eligible to be built, like the outside-only script) and onJobCompleted (for checking that the building actually was constructed) works perfectly. Gives me all the information needed and even gives me extra stuff which allows me to speed up/slow down the construction of buildings among other things.
Logged

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1647 on: February 20, 2019, 05:45:51 pm »

Is there a way to properly destroy a building? I know there is dfhack.buildings.deconstruct(), but all that does for an already constructed building is add a job for removal, and I want to actually remove the building from existence. I can probably kludge something together, but was wondering if there was already something out there.

EDIT: Nevermind, figured it out. If you set the construction stage to 0 then use dfhack.buildings.deconstruct() it will correctly deconstruct the building.
« Last Edit: February 21, 2019, 09:31:57 am by Roses »
Logged

neutrino431

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1648 on: February 22, 2019, 06:56:17 pm »

How do you spawn a quire with createitem?
Logged

thefriendlyhacker

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1649 on: February 22, 2019, 09:13:04 pm »

Try this:
Code: [Select]
modtools/create-item -creator *id* -material PLANT:GRASS_TAIL_PIG:THREAD -item TOOL:ITEM_TOOL_QUIRE
Use teleport -showunitid to get the ID of one of your units

There is also gui/create-item, which brings up a screen for you to pick your item/material from.
Logged
Fallout Equestria Redux - that's right, it's back
Pages: 1 ... 108 109 [110] 111 112