Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 6 7 [8] 9 10 ... 42

Author Topic: [DFHack] Roses' Script Collection Updated 5/4/15  (Read 125183 times)

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack Spells *New Scripts incoming soon!*
« Reply #105 on: April 10, 2014, 01:16:13 am »

You need to accept the thing that is in header file thus void* and the name that is there. As for what you pass into a lua event, you might need to do a cast (i.e. reinterpret_cast<df::unit*>(p1) ). Also i think that there is no DEFINE_LUA_EVENT_8, so you might need to add it (or skip some parameters).


fake edit:
Looked at structures, looks like somebody did research on it. Now it's called "doAction".
Code: [Select]
<vmethod name='doAction'>
                <pointer type-name='unit'/>
                <pointer type-name='unit_syndrome'/>
                <pointer type-name='syndrome'/>
                <int32_t name='intensity'/>
                <int16_t name='bp_index'/>
                <int16_t name='bp_layer'/>
                <pointer pointer-type='unit_wound'/>
            </vmethod>
As for vmethod_name, see the generated headers. It'll be something like "anon_method3" or something.

Roses

  • Bay Watcher
    • View Profile
Re: DFHack Spells *New Scripts incoming soon!*
« Reply #106 on: April 10, 2014, 11:03:51 am »

Hmmm, it looks like someone already did the work, and unfortunately it doesn't look like the information I want is there, unless unit_syndrome means the unit who casted the syndrome. I suppose I will check if that is the case.

EDIT: Do you know who might have done the research on that vmethod? Might save me time to just talk to them.
« Last Edit: April 10, 2014, 12:02:11 pm by Roses »
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack Spells *New Scripts incoming soon!*
« Reply #107 on: April 10, 2014, 02:31:00 pm »

If anything, "unit" would be the one who did the interaction and "unit_syndrome" would be the one who didn't.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack Spells *New Scripts incoming soon!*
« Reply #108 on: April 10, 2014, 02:32:50 pm »

Hmmm, it looks like someone already did the work, and unfortunately it doesn't look like the information I want is there, unless unit_syndrome means the unit who casted the syndrome. I suppose I will check if that is the case.

EDIT: Do you know who might have done the research on that vmethod? Might save me time to just talk to them.

angavrilov was the one who added the info.

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack Spells *New Scripts incoming soon!*
« Reply #109 on: April 10, 2014, 02:53:34 pm »

If anything, "unit" would be the one who did the interaction and "unit_syndrome" would be the one who didn't.
Even if that is true, there is no easy way to get to unit when you know unit_syndrome. Also the last argument is "df::unit_wound**" so maybe it's used to create new wounds? Not sure how that works.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack Spells *New Scripts incoming soon!*
« Reply #110 on: April 10, 2014, 04:19:04 pm »

Since the previous two are bp_index and bp_layer, I assume it has to do with tissue-affecting creature effects.

Roses

  • Bay Watcher
    • View Profile
Re: DFHack Spells *New Scripts incoming soon!*
« Reply #111 on: April 10, 2014, 05:26:04 pm »

If anything, "unit" would be the one who did the interaction and "unit_syndrome" would be the one who didn't.
Even if that is true, there is no easy way to get to unit when you know unit_syndrome. Also the last argument is "df::unit_wound**" so maybe it's used to create new wounds? Not sure how that works.

Well I was hoping that they would both be available so that a plugin could read both when called. I will contact angavrilov and ask what they know, and possibly try and determine what exactly is being pointed to. Hopefully both the caster and target will be available.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack Spells *New Scripts incoming soon!*
« Reply #112 on: April 10, 2014, 09:46:41 pm »

As for vmethod_name, see the generated headers. It'll be something like "anon_method3" or something.

anon_vmethod_3, in fact. Lua can't access the anon vmethods, I assume due to the fact that they're protected methods.
« Last Edit: April 10, 2014, 09:50:20 pm by Putnam »
Logged

ag

  • Bay Watcher
    • View Profile
Re: DFHack Spells *New Scripts incoming soon!*
« Reply #113 on: April 11, 2014, 10:54:11 am »

If anything, "unit" would be the one who did the interaction and "unit_syndrome" would be the one who didn't.

If you look at the XML properly, you will note that unit_syndrome is a structure type, and it has nothing whatsoever to do with doing interactions. This method is involved in per-tick processing of syndromes already active on a unit.
Logged

Roses

  • Bay Watcher
    • View Profile
Re: DFHack Spells *New Scripts incoming soon!*
« Reply #114 on: April 11, 2014, 01:01:41 pm »

If anything, "unit" would be the one who did the interaction and "unit_syndrome" would be the one who didn't.

If you look at the XML properly, you will note that unit_syndrome is a structure type, and it has nothing whatsoever to do with doing interactions. This method is involved in per-tick processing of syndromes already active on a unit.

Hmm, thats too bad.

The only thing left that I can think about is a more rigorous analysis of the announcements. There are these two types;
Code: [Select]
        <enum-item name='INTERACTION_ACTOR'/>
        <enum-item name='INTERACTION_TARGET'/>
Maybe I can trigger an announcement check right when the script is run? The only problem with that is that I was getting some cross chatter between multiple interactions being used at the same time.

I'm surprised there isn't a more direct link between units that use interactions and their targets, or maybe its just buried somewhere else. Anyway, I will try and see what I can do with the announcements, if anyone has any ideas I am all ears.
Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: DFHack Spells *New Scripts incoming soon!*
« Reply #115 on: April 11, 2014, 01:21:28 pm »

Well, what exactly are you trying to do with announcements?
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 :::

Roses

  • Bay Watcher
    • View Profile
Re: DFHack Spells *New Scripts incoming soon!*
« Reply #116 on: April 11, 2014, 01:39:00 pm »

All I am trying to do is reliably get the target and user of an interaction when it is used. Like how you can currently say \UNIT_ID, I would like to instead have \TARGET_ID and \USER_ID.

The only way I have found so far is to read announcements (generated from CDI:VERB and CDI:TARGET_VERB) to determine the users name and find the unit that way. The problem with that method is when there are several interactions being used at once, I have not found a reliable way to make sure the correct announcement is tied to the correct action. It may be that the announcements (VERB and TARGET_VERB) are linked in some way, if that is the case then I could read the targets announcements and determine from there, although it may have the same problem as it does now, where many interactions, used simultaneously, results in incorrect assignment of \USER_ID.
Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: DFHack Spells *New Scripts incoming soon!*
« Reply #117 on: April 11, 2014, 03:51:02 pm »

I know nothing about lua/dfhack, but why not write a short message to Tarn Adams? He has always replied to me relatively quickly and in a friendly manner. If this question is so specialized that even veteran dfhack scripters dont know the answer, maybe he can point you in the right direction.
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 :::

Roses

  • Bay Watcher
    • View Profile
Re: DFHack Spells *New Scripts incoming soon!*
« Reply #118 on: April 11, 2014, 06:13:47 pm »

I have thought about it, but given the fact that we are basically hacking into his code (albeit in the nicest way possible), I am not sure he would take kindly to a question concerning the inner workings of the code. I will attempt to try a couple more things and look through some more of the df-structures to see if there is anything I see. If all else fails I suppose it can't hurt to ask.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack Spells *New Scripts incoming soon!*
« Reply #119 on: April 11, 2014, 06:39:58 pm »

He hasn't reacted all too negatively whenever I've seen people say how things work in the code while he's watching; hell, IIRC I've seen him confirm it occasionally. He also accepts binary patches readily.
Pages: 1 ... 6 7 [8] 9 10 ... 42