Page 1 of 1

GetStatSize() (ZScript)

PostPosted: Sat Jun 02, 2018 2:52 pm
by Major Cooke
Simple. A static function that returns the size of a specified stat. If left empty or is some invalid number, defaults to maximum stat + 1 which means it gets the size combined of all stats.

Re: GetStatSize() (ZScript)

PostPosted: Sat Jun 02, 2018 5:37 pm
by Marisa Kirisame
What do you mean by "size of a stat"?

Re: GetStatSize() (ZScript)

PostPosted: Sat Jun 02, 2018 11:35 pm
by Major Cooke
How many active thinkers are in a particular stat.

Right now you can only do a while loop until it's all the way over which strikes me as inefficient when just trying to establish how many thinkers are in there -- especially if it's on ZScript's side. Probably much better to have it done on the source if anything, especially if this is done often.

Re: GetStatSize() (ZScript)

PostPosted: Fri Sep 14, 2018 4:57 pm
by ZippeyKeys12
https://github.com/coelckers/gzdoom/pull/574
Let's see if I fucked anything up, or if Graf doesn't want it in. (Or both)

Re: GetStatSize() (ZScript)

PostPosted: Thu Jan 31, 2019 1:00 pm
by Major Cooke
This was closed.

Re: GetStatSize() (ZScript)

PostPosted: Thu Jan 31, 2019 5:56 pm
by Graf Zahl
Major Cooke wrote:especially if this is done often.


You shouldn't do that. If you have to count thinkers in a slot frequently something isn't right. Even natively the engine cannot do anything less than stepping through the entire list and incrementing a counter. This is a very costly operation because it involves several cache misses on the CPU.