Zscript: Searching ACS Thinkers

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Zscript: Searching ACS Thinkers

Postby TXTX » Wed Oct 14, 2020 11:02 am

I'm trying to search through acs actors to be able to change their activator, but don't know if I'm even doing it right.

Code: Select allExpand view
   ThinkerIterator thinkers = ThinkerIterator.Create("Thinker",STAT_SCRIPTS);
   Thinker ThinkerFilter;
   while (ThinkerFilter = Thinker(thinkers.Next()))
   {
   if (ThinkerFilter!=self)
   {
      if (ThinkerFilter.Owner && ThinkerFilter.Owner==oldactor)
      {
         ThinkerFilter.Owner = newactor;
      }
   }
}

It always comes up an error at ThinkerFIlter.Owner, so that's what I'm stuck at. I've tried activator too but that doesn't work. Anyone know what to use here? Oldactor works, but isn't in this part of the code.
User avatar
TXTX
Insane Feline, Hacking through ZScript
 
Joined: 12 Sep 2013
Location: A Hidden Location

Re: Zscript: Searching ACS Thinkers

Postby Player701 » Wed Oct 14, 2020 11:57 pm

From the source code, it looks like there is only one thinker per level that is used to run scripts (DACSThinker), and its iterface is not exposed to ZScript at all. Therefore, it is probably not possible do to what you want at the moment.

As for why your code errors out, it's simple - class Thinker does not have an Owner field.
User avatar
Player701
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Zscript: Searching ACS Thinkers

Postby Graf Zahl » Thu Oct 15, 2020 12:27 am

Yes, there's only one thinker that runs and maintains all scripts. Changing the activator for a single script from ZScript is not possible.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Zscript: Searching ACS Thinkers

Postby Matilda Banderwater » Thu Oct 15, 2020 3:53 am

Curses. There goes an unfixable bug. Thanks for the info.
Matilda Banderwater
 

Re: Zscript: Searching ACS Thinkers

Postby Player701 » Thu Oct 15, 2020 4:25 am

If you told us what exactly you're trying to achieve, maybe we could still help. It's easier when the full context of the problem is known, because your original attempt might not be the only possible solution.
User avatar
Player701
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support


Return to Scripting

Who is online

Users browsing this forum: No registered users and 2 guests