System Timer32

Nexor

...
Reaction score
74
it displays the following message:

"T32 ERROR: Struct #46 had startPeriodic called while already running!"

I'm using the 1.05 version of T32. Could it be the problem?
 

Nexor

...
Reaction score
74
my triggers are on the previous page, I don't see any reason why it is called multiple times...
 

Weep

Godspeed to the sound of the pounding
Reaction score
401
Would it be feasible, or even useful, for the whole T32 system to be a textmacro in order to instantiate the system at a different loop rate? eg. [ljass]//! runtextmacro "TX"(40)[/ljass] would create a library_once named T40 and period 0.02, or [ljass]//! runtextmacro "TX"(2)[/ljass] would create a library_once named T2 and period 0.5?
 

tooltiperror

Super Moderator
Reaction score
231
Would it be feasible, or even useful, for the whole T32 system to be a textmacro in order to instantiate the system at a different loop rate? eg. [ljass]//! runtextmacro "TX"(40)[/ljass] would create a library_once named T40 and period 0.02, or [ljass]//! runtextmacro "TX"(2)[/ljass] would create a library_once named T2 and period 0.5?

Are you thinking of a system to code timers in the vanilla world editor?
 

Jesus4Lyf

Good Idea™
Reaction score
397
Would it be feasible, or even useful, for the whole T32 system to be a textmacro in order to instantiate the system at a different loop rate? eg. [ljass]//! runtextmacro "TX"(40)[/ljass] would create a library_once named T40 and period 0.02, or [ljass]//! runtextmacro "TX"(2)[/ljass] would create a library_once named T2 and period 0.5?
It would be ironic to say the least.
Possible, but what's the point?
 

tooltiperror

Super Moderator
Reaction score
231
It would be ironic to say the least.
Possible, but what's the point?

Well, if I get what Weep is saying, it could possibly mean he is trying to use textmacroes to run the system in the normal editor without [LJASS]//! import[/LJASS]. Of course, I could be wrong.
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
Would it be feasible, or even useful, for the whole T32 system to be a textmacro in order to instantiate the system at a different loop rate? eg. [ljass]//! runtextmacro "TX"(40)[/ljass] would create a library_once named T40 and period 0.02, or [ljass]//! runtextmacro "TX"(2)[/ljass] would create a library_once named T2 and period 0.5?

If you need to, you can always just create a separate timer, trigger, and module for it. (assuming you use that period frequently) Otherwise, you can use KT2, TimerUtils, or just an inlined T32.
 

Jesus4Lyf

Good Idea™
Reaction score
397
If you need to, you can always just create a separate timer, trigger, and module for it.
That's what he's suggesting. A textmacro to create it. It would just mean resources could be submitted using whatever period they like, and since it uses library_once, they would not conflict. It makes sense, if there is any purpose in having multiple periods, which is what I am trying to ask...
 

Weep

Godspeed to the sound of the pounding
Reaction score
401
Are you thinking of a system to code timers in the vanilla world editor?
No. I mean, [lJASS]//! runtextmacro[/lJASS]s and [lJASS]//! import[/lJASS] still require JassHelper, but actually, that's an interesting thought. It's completely unrelated to this question, though.

It makes sense, if there is any purpose in having multiple periods, which is what I am trying to ask...
T32 is supposedly the most efficient timer system possible, but only works for a single period. If someone wanted to use a different period, they couldn't use T32 without modifying its setting, which would possibly mess up any other imported resources using T32. Some people (like Viikuna and myself) like periods faster than 32/sec for sliding effects; also, some periodic effects don't need to be that fast.

Wouldn't it be more efficient, and possibly easier to implement, than KT2 to have a few T32-style systems running at specific, pre-specified periods, or than having a resource check the T32 tick and only execute every 3rd time?

I suppose you'd argue that any period faster than 32/sec is not noticeable (false) and any period longer than 32/sec probably needs to be exactly in phase with the start event (questionable), but, still I present my thinking behind the question.
 

Jesus4Lyf

Good Idea™
Reaction score
397
If someone wanted to use a different period, they couldn't use T32 without modifying its setting, which would possibly mess up any other imported resources using T32. Some people (like Viikuna and myself) like periods faster than 32/sec for sliding effects
In these cases, the authors should write the systems to be independent of the FPS of T32 - ie. they should perform calculations based on T32_PERIOD. This allows a map author to set T32_PERIOD to whatever they wish. So a slide system built on T32 would use whatever FPS the map author wishes - indeed, if the entire map runs too slow, just make T32 fire less frequently. Unfortunate that the resource name itself has "32" in it in hindsight.

also, some periodic effects don't need to be that fast.
This is the real thing I'm looking for. Can you give some examples?
 

Weep

Godspeed to the sound of the pounding
Reaction score
401
This is the real thing I'm looking for. Can you give some examples?
Damage over time. Effects over time on units in an area. Detecting units entering an area (like auras). Checking for presence of a buff. Rapid but not OMG-FAST repeating special effects. The non-visual component of an in-a-line spell (32 enums/sec? Madness!) Very slow slides that don't need such a framerate to still look smooth, or sliding ribbon emitters (which themselves have an emission rate that is pointless to exceed). These are things that I tend to run at 0.1-0.25s.
 

baassee

Member
Reaction score
5
Lol DPS
real damage, real time, T32's Period 32FPS
damage * PERIOD / time same as (time / PERIOD) * damage ,to make it tick each interval but still do the same amount of damage

Just have a member and increase it and when it reaches a certain value (your 0.1-0.25) you set it to 0. and do your stuff, isn't that easy enough :D

EDIT: Soz, didn't notice the necro post.
 

koeienboei

Member
Reaction score
4
Hmm im not familiar with these modules and stuff. How do you write an easy loop with delay with this T32:

loop
move fireball
wait(0.01)
endloop
 

tooltiperror

Super Moderator
Reaction score
231
JASS:
library foo requires TimerUtils

	private struct Data

		private integer tick=0
		private unit    killer

		private method periodic takes nothing returns nothing
			set this.tick=.tick+T32_PERIOD
			if(tick==T32_FPS*5(then
				if (UnitAlive(this.killer)) then
					call KillUnit(this.killer)
					call this.stopPeriodic()
				endif
			endif
		endmethod

		private static method actions takes nothing returns nothing
			local thistype this=thistype.create()
			set this.killer=GetKillingUnit()
			call this.startPeriodic()
		endmethod

		private static method onInit takes nothing returns nothing
			// register a death event
			// register thistype.actions as a callback
		endmethod
	
		implement T32x // <--- that is what actually adds it

	endstruct

endlibrary


:thup:
 

Jesus4Lyf

Good Idea™
Reaction score
397
loop
move fireball
wait(0.01)
endloop
JASS:
struct Move
    real dx
    real dy
    unit subject
    private method periodic takes nothing returns nothing
        call SetUnitX(subject, GetUnitX(subject) + dx)
        call SetUnitY(subject, GetUnitY(subject) + dy)
    endmethod
    implement T32x
    private static method create takes unit which, real xPerSecond, real yPerSecond returns thistype
        local thistype this = thistype.allocate()
        set this.dx = xPerSecond * T32_PERIOD
        set this.dy = yPerSecond * T32_PERIOD
        set this.subject = which
        call this.startPeriodic()
        return thistype
    endmethod
    method destroy takes nothing returns nothing
        call this.stopPeriodic()
        call this.deallocate()
    endmethod
endstruct

I've written it freehand, but should work. Just use something like:
JASS:
local unit myFireball = // whatever, make some fireball.
local Slide s = Slide.create(myFireball, 1000, 500)
call TriggerSleepAction(2.0)
call s.destroy()
//remove fireball

That will move the fireball with a speed of 1000 x and 500 y for 2 seconds. Hope it helps. :thup:
 

koeienboei

Member
Reaction score
4
Hmm this should work pretty good, tyvm :)

1 problem, it sais im redeclaring method destroy :/

I tried making it private but didnt work + i cant find anything else that is called destroy in the jass compile screen
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top