Page 1 of 1

Zscript: Searching ACS Thinkers

Posted: Wed Oct 14, 2020 11:02 am
by TXTX
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 all

	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.

Re: Zscript: Searching ACS Thinkers

Posted: Wed Oct 14, 2020 11:57 pm
by Player701
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.

Re: Zscript: Searching ACS Thinkers

Posted: Thu Oct 15, 2020 12:27 am
by Graf Zahl
Yes, there's only one thinker that runs and maintains all scripts. Changing the activator for a single script from ZScript is not possible.

Re: Zscript: Searching ACS Thinkers

Posted: Thu Oct 15, 2020 3:53 am
by Guest
Curses. There goes an unfixable bug. Thanks for the info.

Re: Zscript: Searching ACS Thinkers

Posted: Thu Oct 15, 2020 4:25 am
by Player701
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.