Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2]

Author Topic: [DFHack] Probability-syndrome: Run AutoSyndrome cmds honouring reaction probs!  (Read 7942 times)

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist

It still doesn't work with \LOCATION. Same error as before. I tried both the script you send me in the PM and the one posted here. (I assume they are the same, but I wanted to be sure)

I am using this inorganic:
Code: [Select]
[INORGANIC:SPAWN_ZOMBIE_PROB]
    [USE_MATERIAL_TEMPLATE:STONE_VAPOR_TEMPLATE]
    [SYNDROME]
        [SYN_CLASS:\AUTO_SYNDROME]
        [SYN_CLASS:\COMMAND]
        [SYN_CLASS:probability-syndrome][SYN_CLASS:cmd]
[SYN_CLASS:spawn]
[SYN_CLASS:ZOMBIE_WARLOCK]
[SYN_CLASS:0]
[SYN_CLASS:Restless Walker]
[SYN_CLASS:\LOCATION]

When it should trigger, it gives this error message:
Code: [Select]
        ...F\MasterworkDF V4f\Dwarf Fortress\hack\scripts/spawn.lua:185: in function 'PlaceUnit'
        ...F\MasterworkDF V4f\Dwarf Fortress\hack\scripts/spawn.lua:255: in main chunk
        (...tail calls...)
Cannot write field coord.x: number expected.stack traceback:
        [C]: in ?
        [C]: in function 'assign'
[DFHack]#

Should the inorganic look different?
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 :::

Urist McTeellox

  • Bay Watcher
    • View Profile

It still doesn't work with \LOCATION. Same error as before. I tried both the script you send me in the PM and the one posted here. (I assume they are the same, but I wanted to be sure)

Oh drat. I know what's going on there, although I'm not sure if I can fix it easily. The interface I have for running DFHack commands doesn't let me pass in individual arguments, instead they all get concatenated into a string and that gets passed. The end result is that spaces in arguments (eg: Restless Walker) will cause problems.

We *may* be able to get around that with quotes (SYN_CLASS:'Restless Walker' or SYN_CLASS:"Restless Walker"), but I haven't tested that. Alternatively names without spaces should fix things.  (If the quotes work, let me know, because it means I may be able to improve my argument passing by using them.)

If you're doing lots of spawning (which I know you are), then I can update the spawn script so that it considers all non-numeric arguments after the caste to be the name. That should work around this limitation, and keep backwards compatibility with everything else that uses spawn. However it means you can't spawn creatures with names that *start* with numbers.

~ T
Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist

Thanks for the quick answer. :)

"Restless Walker" does indeed fix it. Arguments with spaces in "" are counted as one argument. :)
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 :::

Urist McTeellox

  • Bay Watcher
    • View Profile

Thanks for the quick answer. :)

"Restless Walker" does indeed fix it. Arguments with spaces in "" are counted as one argument. :)

Excellent! That means I can update the script later to automatically quote arguments where needed. (And don't worry, it'll pick up when you've already quoted things already and not mess with them.)

Thank you for testing! :D

~ T
Logged

expwnent

  • Bay Watcher
    • View Profile

Auto-Syndrome never triggers when the reaction is set to repeat. 'R'. Does this change with Probability-Syndrome? Can I have a reaction thats 10% and just 'R' it?

In other words, it's triggering when the job is removed, not when the job is completed. If these jobs are always custom reactions, then it would probably be more reliable to write a C++ plugin which interposes reaction_product_itemst::produce(...) and checks for the appropriate name, then goes back through the unit to get the job and the rest of the info for the reaction being performed.

Replying to give a brief explanation. The problem was what Quietust said. I didn't test the JOB_COMPLETED event with repeat jobs. I have since switched to an even more reliable method than what he suggested, which is to look at the time to complete tick and repeat flag and do fancy logic (that I've tested thoroughly) to see if the job was completed. The tricky part is to get it to work even for custom reactions that do not produce anything. The EventManager library exists outside of the autoSyndrome plugin, so it should work for that even if autoSyndrome doesn't need it.

This has been fixed in r4.
Logged

Roses

  • Bay Watcher
    • View Profile

Does this mean that auto syndrome will now trigger on repeat jobs AND that it won't trigger when cancelled? Will it also respect probabilities (obviously not like McTeellox's script does, but just normal DF probabilities)?
Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist

I have the R4 version of Autosyndrome, I havent tested it in a while, but I think it still triggers when cancelled.
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 :::

expwnent

  • Bay Watcher
    • View Profile

It didn't trigger on manual cancellation the last time I checked. I definitely tested that but it's plausible I missed something.
Logged
Pages: 1 [2]