Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: DFHack interaction-trigger not working  (Read 1810 times)

ChaoSquidingus

  • Escaped Lunatic
    • View Profile
DFHack interaction-trigger not working
« on: July 07, 2018, 05:08:14 pm »

I've been trying to make a mod for a friend and I've been having some issues with interaction-trigger. I have read DFHack's documentation and Roses' documentation of interaction-trigger on Github, although I'm probably being really stupid and missed an important part or something, and if I am, sorry about that.

Here's my onLoad init file, which is separate from DFHack's default init file.
Spoiler (click to show/hide)

And the script that it's using to test it.
Spoiler (click to show/hide)

And if that's not enough to find the problem, here's the whole mod folder itself uploaded on Google Drive.
https://drive.google.com/open?id=1mxlounuLDs1hsl_BgXTnyaKxXAsnWFTC
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack interaction-trigger not working
« Reply #1 on: July 07, 2018, 06:58:51 pm »

What specifically is "not working"? Does it produce an error message, or does it just do nothing? Are you certain that you've saved that file as hack/scripts/terminator/eatyourlead.lua (or another valid scripts folder)? What does running "type terminator/eatyourlead" in the DFHack console give you? What if you put a print statement in your script - does it print something to the console? Is your -onAttackStr argument spelled correctly?
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.

ChaoSquidingus

  • Escaped Lunatic
    • View Profile
Re: DFHack interaction-trigger not working
« Reply #2 on: July 07, 2018, 08:17:27 pm »


What specifically is "not working"? Does it produce an error message, or does it just do nothing?
Just does nothing.
Are you certain that you've saved that file as hack/scripts/terminator/eatyourlead.lua (or another valid scripts folder)?
Saved in raw/scripts/terminator/eatyourlead.lua. Switching the interaction-trigger -command section to the full path did nothing, and moving it to the hack/scripts and switching to that full path just produced this error
Spoiler (click to show/hide)
After switching to terminator/eatyourlead then did nothing.
What does running "type terminator/eatyourlead" in the DFHack console give you?
Type terminator/eatyourlead gives me "terminator/eatyourlead is a Lua script" and then links to that "raw/scripts/terminator/eatyourlead.lua" path and gave me the same error, from what I can tell, but here's that one just in case it isn't.
Spoiler (click to show/hide)
What if you put a print statement in your script - does it print something to the console?
Doesn't seem to print anything. The eatyourlead script became this when I changed it.
Spoiler (click to show/hide)
Is your -onAttackStr argument spelled correctly?
Seems to be spelled right.

On top of that, I tried replacing double quotes with single quotes, and checking the stderr.log seems to be invoking the modtools/interaction-trigger commands in the init properly. Randomly said "UNKNOWN CLASS 'viewscreen_commandpromptst': vtable = 0x7fedd8489b0" in there too, which I'm assuming isn't related. I should also note that I'm using "dfhack-0.44.10-r1-Windows-64".
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack interaction-trigger not working
« Reply #3 on: July 07, 2018, 10:12:02 pm »

Full script paths don't generally work - if "type" gives you the path to the script, then it's in the right place. I probably should have mentioned "type" first.

I'm not sure what you mean by "switching to that full path" when you got the error message - using anything longer than "terminator/eatyourlead" should have produced something similar to "command not found". In any case, it doesn't like the "fire your armcannon" argument. I'm not really sure why. Does it work if you run it from the console? Single quotes definitely won't work, in any case.

Also, you can copy text by right clicking in the console window or the title bar. That's usually easier to read/search than a screenshot.

Replace dfhack.println with print - that's what I meant by "print statement". dfhack.println doesn't always display its output right away, so don't use it unless you have a good reason to.

The viewscreen_commandpromptst message showed up when you ran command-prompt for the first time (ctrl-shift-p). It's harmless and unrelated, as you guessed.
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.

ChaoSquidingus

  • Escaped Lunatic
    • View Profile
Re: DFHack interaction-trigger not working
« Reply #4 on: July 07, 2018, 10:34:57 pm »

I'm not sure what you mean by "switching to that full path" when you got the error message
When I said switching to the full path, I meant I made the script it was going to in the init file raws/scripts/terminator/eatyourlead instead of just the shorthand version.
Does it work if you run it from the console? Single quotes definitely won't work, in any case.
Doesn't seem to, no. Even tried it with a repeat command running it too, even though I'm pretty sure it's not needed, but still nothing. Also, when removing the single quotes, the error stopped popping up.
Also, you can copy text by right clicking in the console window or the title bar. That's usually easier to read/search than a screenshot.
Alright, I'll keep that in mind for later.
Replace dfhack.println with print - that's what I meant by "print statement". dfhack.println doesn't always display its output right away, so don't use it unless you have a good reason to.
Oh, huh. I swear I remembered using print and it not working, but I probably just used it wrong.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack interaction-trigger not working
« Reply #5 on: July 07, 2018, 11:06:54 pm »

Do you mean you literally put the string "raws/scripts/terminator/eatyourlead" in the init file? That won't work. Only "terminator/eatyourlead" will work - it's not a "shorthand version", it's the only working one.

Oh, so with single quotes, 'fire your armcannon' is treated as three separate arguments:
Code: [Select]
'fire
your
armcannon'
while double quotes give one,
Code: [Select]
fire your armcannonSo the lack of an error with double quotes most likely means your syntax is valid.

Are announcements/reports with these "armcannon" strings in them happening?

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.

ChaoSquidingus

  • Escaped Lunatic
    • View Profile
Re: DFHack interaction-trigger not working
« Reply #6 on: July 07, 2018, 11:40:41 pm »

Do you mean you literally put the string "raws/scripts/terminator/eatyourlead" in the init file? That won't work. Only "terminator/eatyourlead" will work - it's not a "shorthand version", it's the only working one.
Yep, I do. Also, yeah, not really sure why I called it a shorthand version, hehe

Are announcements/reports with these "armcannon" strings in them happening?
Yep, right here.
Spoiler (click to show/hide)
Logged