Frame Timer Bundle

This is a very simple timer that counts game frames rather than real-time seconds:

Code
{"data":{"behavior":{"v":"2","nodes":[{"inputCount":6,"outputCount":2,"name":"Frame Timer","behaviorType":"logic.NodeGroup","x":180,"y":96,"id":"77e1d1dcee404b44","isMenuItem":false},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":0,"y":0,"group":"77e1d1dcee404b44","id":"77e1d1dc1615f74a","startVal":0,"tag":"(0,0)","roundMode":1},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":180,"y":96,"group":"77e1d1dcee404b44","id":"77e1d1dc85f34747","portId":"77e1d1dcee404b44i0","tag":"Delay","dataType":2},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":180,"y":160,"group":"77e1d1dcee404b44","id":"77e1d1dc14425b4c","portId":"77e1d1dcee404b44i1","tag":"Repeat Count","dataType":2},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":180,"y":224,"group":"77e1d1dcee404b44","id":"77e1d1dc5a70e44e","portId":"77e1d1dcee404b44i2","tag":"Pause","dataType":2},{"expression":"(B%A)==0?1:0","default0":1,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":2,"version":2,"tag":"Frame Delay","inputCount":3,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":1080,"y":480,"group":"77e1d1dcee404b44","id":"77e1d1dcb86cba44"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":1440,"y":448,"group":"77e1d1dcee404b44","id":"77e1d1dcfe23e847","startVal":0,"tag":"Output Number","roundMode":1},{"gateVal":1,"mode":"equal to","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter","x":1260,"y":512,"group":"77e1d1dcee404b44","id":"77e1d1dc298a1741"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":360,"y":416,"group":"77e1d1dcee404b44","id":"77e1d1dc80adf642","startVal":0,"tag":"Reset","roundMode":1},{"inputCount":1,"outputCount":0,"name":"Bundle Output","behaviorType":"logic.NodeGroupOutput","x":1620,"y":352,"group":"77e1d1dcee404b44","id":"77e1d1dd6859e746","portId":"77e1d1dcee404b44o0","tag":"Out#","dataType":2},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":180,"y":288,"group":"77e1d1dcee404b44","id":"77e1d1dd37f08d41","portId":"77e1d1dcee404b44i3","tag":"Resume","dataType":2},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":180,"y":352,"group":"77e1d1dcee404b44","id":"77e1d1ddb7e0d541","portId":"77e1d1dcee404b44i4","tag":"Reset","dataType":2},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":180,"y":416,"group":"77e1d1dcee404b44","id":"77e1d1dd5df2504d","portId":"77e1d1dcee404b44i5","tag":"Start","dataType":2},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":540,"y":576,"group":"77e1d1dcee404b44","id":"77e1d1dd593c3645","_startVal":1,"dataType":2},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":360,"y":608,"group":"77e1d1dcee404b44","id":"77e1d1dd20357940","_startVal":0,"dataType":2},{"inputCount":0,"outputCount":1,"name":"Always","behaviorType":"logic.triggers.Always","x":180,"y":640,"group":"77e1d1dcee404b44","id":"77e1d1dda73ce549"},{"inputCount":1,"outputCount":0,"name":"Bundle Output","behaviorType":"logic.NodeGroupOutput","x":1980,"y":640,"group":"77e1d1dcee404b44","id":"77e1d1dd495e254a","portId":"77e1d1dcee404b44o1","tag":"Done","dataType":2},{"expression":"B==A?1:0","default0":1,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":2,"version":2,"tag":"==Repeat Count?","inputCount":3,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":1620,"y":416,"group":"77e1d1dcee404b44","id":"77e1d1dd681cd444"},{"gateVal":0,"mode":"greater than","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter","x":540,"y":224,"group":"77e1d1dcee404b44","id":"77e1d1ddc618344e"},{"expression":"Math.round((Math.max(A,0)),1)","default0":0,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":1,"version":2,"tag":"Nearest Positive Integer","inputCount":2,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":360,"y":192,"group":"77e1d1dcee404b44","id":"77e1d1dd6744454b"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":900,"y":512,"group":"77e1d1dcee404b44","id":"77e1d1dd826af149","startVal":0,"tag":"Frame Number","roundMode":1},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":720,"y":544,"group":"77e1d1dcee404b44","id":"77e1d1dd90966b48","_startVal":1,"dataType":2},{"gateVal":1,"mode":"equal to","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter","x":1800,"y":448,"group":"77e1d1dcee404b44","id":"77e1d1dd67971b43"},{"expression":"Math.round((Math.max(A,1)),1)","default0":0,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":1,"version":2,"tag":"Nearest Positive Integer Excluding 0","inputCount":2,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":360,"y":96,"group":"77e1d1dcee404b44","id":"77e1d1dd0c9ffc4f"}],"links":[{"input_id":"77e1d1dd0c9ffc4fi0","output_id":"77e1d1dc85f34747o0"},{"input_id":"77e1d1dd0c9ffc4fi1","output_id":"77e1d1dc85f34747o0"},{"input_id":"77e1d1dd6744454bi0","output_id":"77e1d1dc14425b4co0"},{"input_id":"77e1d1dd6744454bi1","output_id":"77e1d1dc14425b4co0"},{"input_id":"77e1d1dd593c3645i0","output_id":"77e1d1dc5a70e44eo0"},{"input_id":"77e1d1dc298a1741i0","output_id":"77e1d1dcb86cba44o0"},{"input_id":"77e1d1dd6859e746i0","output_id":"77e1d1dcfe23e847o0"},{"input_id":"77e1d1dd681cd444i1","output_id":"77e1d1dcfe23e847o0"},{"input_id":"77e1d1dd681cd444i2","output_id":"77e1d1dcfe23e847o0"},{"input_id":"77e1d1dcfe23e847i2","output_id":"77e1d1dc298a1741o0"},{"input_id":"77e1d1dcfe23e847i0","output_id":"77e1d1dc80adf642o0"},{"input_id":"77e1d1dd826af149i0","output_id":"77e1d1dc80adf642o0"},{"input_id":"77e1d1dd593c3645i1","output_id":"77e1d1dc80adf642o0"},{"input_id":"77e1d1dd593c3645i1","output_id":"77e1d1dd37f08d41o0"},{"input_id":"77e1d1dc80adf642i1","output_id":"77e1d1ddb7e0d541o0"},{"input_id":"77e1d1dd20357940i0","output_id":"77e1d1ddb7e0d541o0"},{"input_id":"77e1d1dc80adf642i1","output_id":"77e1d1dd5df2504do0"},{"input_id":"77e1d1dd20357940i1","output_id":"77e1d1dd5df2504do0"},{"input_id":"77e1d1dd90966b48i2","output_id":"77e1d1dd593c3645o0"},{"input_id":"77e1d1dd593c3645i2","output_id":"77e1d1dd20357940o0"},{"input_id":"77e1d1dd20357940i2","output_id":"77e1d1dda73ce549o0"},{"input_id":"77e1d1dd67971b43i0","output_id":"77e1d1dd681cd444o0"},{"input_id":"77e1d1dd681cd444i0","output_id":"77e1d1ddc618344eo0"},{"input_id":"77e1d1dd90966b48i1","output_id":"77e1d1ddc618344eo0"},{"input_id":"77e1d1dd90966b48i0","output_id":"77e1d1ddc618344eo1"},{"input_id":"77e1d1ddc618344ei0","output_id":"77e1d1dd6744454bo0"},{"input_id":"77e1d1dcb86cba44i1","output_id":"77e1d1dd826af149o0"},{"input_id":"77e1d1dcb86cba44i2","output_id":"77e1d1dd826af149o0"},{"input_id":"77e1d1dd826af149i2","output_id":"77e1d1dd90966b48o0"},{"input_id":"77e1d1dc80adf642i1","output_id":"77e1d1dd67971b43o0"},{"input_id":"77e1d1dd20357940i0","output_id":"77e1d1dd67971b43o0"},{"input_id":"77e1d1dd495e254ai0","output_id":"77e1d1dd67971b43o0"},{"input_id":"77e1d1dcb86cba44i0","output_id":"77e1d1dd0c9ffc4fo0"}]}}}

I just figured I’d share this since I find it pretty useful to have a timer that stays consistent with the game’s framerate. It’s especially good for weapon fire rates and things like that (which can start to trigger too often with a normal timer when a game lags a lot).
This timer bundle also includes inputs and outputs that I would love to have on the normal Timer behavior (Repeat Count, Pause, Resume, Output Number, and Done).

6 Likes

I’ve been using one of these for a while, really useful

2 Likes

I recently made a new version of this and figured I should share it:
Frame Timer

Frame Timer Code
{"data":{"behavior":{"v":"2","nodes":[{"inputCount":7,"outputCount":2,"name":"Frame Timer","behaviorType":"logic.NodeGroup","x":180,"y":80,"id":"366ec79b25cec045","notes":"You need to connect an Always behavior to the Always input here in order for this to work (but make sure the Always behavior is below any other behaviors that set this timer's properties),\nThis timer counts by frames instead of seconds, so it always is consistent with the game's framerate, not the real life time. \nInputting anything greater than 0 to the Repeat input will set how many frames to wait between Out# outputs.\nSetting Repeat to 0 just disables this entire timer.\nSetting Repeat to -1 makes the timer repeat forever (unlimited output count)","n_o":1,"isMenuItem":false},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":180,"y":96,"group":"366ec79b25cec045","id":"366ec79bf1e5644d","portId":"366ec79b25cec045i0","tag":"Delay","dataType":2},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":180,"y":160,"group":"366ec79b25cec045","id":"366ec79b6140e34e","portId":"366ec79b25cec045i1","tag":"Repeat Count","dataType":2},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":180,"y":224,"group":"366ec79b25cec045","id":"366ec79cf8b1864b","portId":"366ec79b25cec045i2","tag":"Pause","dataType":2},{"expression":"(B%A)==0?1:0","default0":30,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":2,"version":2,"tag":"Frame Delay","inputCount":3,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":1080,"y":480,"group":"366ec79b25cec045","id":"366ec79c7fcd2144"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":1440,"y":448,"group":"366ec79b25cec045","id":"366ec79ce8c59245","startVal":0,"tag":"Output Number","roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":360,"y":416,"group":"366ec79b25cec045","id":"366ec79c521fca40","startVal":0,"tag":"Reset","roundMode":1},{"inputCount":1,"outputCount":0,"name":"Bundle Output","behaviorType":"logic.NodeGroupOutput","x":1800,"y":320,"group":"366ec79b25cec045","id":"366ec79d4489b44b","portId":"366ec79b25cec045o0","tag":"Out#","dataType":2},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":180,"y":288,"group":"366ec79b25cec045","id":"366ec79d0914884a","portId":"366ec79b25cec045i3","tag":"Resume","dataType":2},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":180,"y":352,"group":"366ec79b25cec045","id":"366ec79d3934f549","portId":"366ec79b25cec045i4","tag":"Reset","dataType":2},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":180,"y":416,"group":"366ec79b25cec045","id":"366ec79d20aa644b","portId":"366ec79b25cec045i5","tag":"Start","dataType":2},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":540,"y":576,"group":"366ec79b25cec045","id":"366ec79dae5faa49","_startVal":1,"dataType":2},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":360,"y":608,"group":"366ec79b25cec045","id":"366ec79d22fcb948","_startVal":0,"dataType":2},{"inputCount":1,"outputCount":0,"name":"Bundle Output","behaviorType":"logic.NodeGroupOutput","x":2160,"y":464,"group":"366ec79b25cec045","id":"366ec79d8e381a44","portId":"366ec79b25cec045o1","tag":"Done","dataType":2},{"expression":"B==A?1:0","default0":1,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":2,"version":2,"tag":"==Repeat Count?","inputCount":3,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":1800,"y":384,"group":"366ec79b25cec045","id":"366ec79d26478a41"},{"expression":"Math.round((Math.max(A,-1)),1)","default0":0,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":1,"version":2,"tag":"Nearest Positive Integer","inputCount":2,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":360,"y":192,"group":"366ec79b25cec045","id":"366ec79e3d520747"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":900,"y":512,"group":"366ec79b25cec045","id":"366ec79e90e8bd46","startVal":0,"tag":"Frame Number","roundMode":1},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":720,"y":544,"group":"366ec79b25cec045","id":"366ec79eb5af0e44","_startVal":1,"dataType":2},{"expression":"Math.round((Math.max(A,1)),1)","default0":0,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":1,"version":2,"tag":"Nearest Positive Integer Excluding 0","inputCount":2,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":360,"y":96,"group":"366ec79b25cec045","id":"366ec79eb5b45b48"},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":180,"y":664,"group":"366ec79b25cec045","id":"366ec79eb7ea3e48","portId":"366ec79b25cec045i6","tag":"Always","dataType":2},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":1620,"y":328,"group":"366ec79b25cec045","id":"366ec79e5ad34e42","_startVal":1,"dataType":2},{"gateVal":1,"mode":"equal to","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter2","x":1260,"y":504,"group":"366ec79b25cec045","id":"366ec79e325c7843"},{"gateVal":0,"mode":"not equal to","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter2","x":540,"y":200,"group":"366ec79b25cec045","id":"366ec79ea3d4c64f"},{"gateVal":1,"mode":"equal to","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter2","x":1980,"y":408,"group":"366ec79b25cec045","id":"366ec79e75d40c46"},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":1620,"y":416,"group":"366ec79b25cec045","id":"366ec79e9cd2444a","_startVal":1,"dataType":2},{"gateVal":-1,"mode":"equal to","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter2","x":720,"y":192,"group":"366ec79b25cec045","id":"366ec79e4e76b242"}],"links":[{"input_id":"366ec79eb5b45b48i0","output_id":"366ec79bf1e5644do0"},{"input_id":"366ec79eb5b45b48i1","output_id":"366ec79bf1e5644do0"},{"input_id":"366ec79e3d520747i0","output_id":"366ec79b6140e34eo0"},{"input_id":"366ec79e3d520747i1","output_id":"366ec79b6140e34eo0"},{"input_id":"366ec79dae5faa49i0","output_id":"366ec79cf8b1864bo0"},{"input_id":"366ec79e325c7843i1","output_id":"366ec79c7fcd2144o0"},{"input_id":"366ec79e5ad34e42i2","output_id":"366ec79ce8c59245o0"},{"input_id":"366ec79e9cd2444ai2","output_id":"366ec79ce8c59245o0"},{"input_id":"366ec79ce8c59245i0","output_id":"366ec79c521fca40o0"},{"input_id":"366ec79e90e8bd46i0","output_id":"366ec79c521fca40o0"},{"input_id":"366ec79dae5faa49i1","output_id":"366ec79c521fca40o0"},{"input_id":"366ec79dae5faa49i1","output_id":"366ec79d0914884ao0"},{"input_id":"366ec79c521fca40i1","output_id":"366ec79d3934f549o0"},{"input_id":"366ec79d22fcb948i0","output_id":"366ec79d3934f549o0"},{"input_id":"366ec79c521fca40i1","output_id":"366ec79d20aa644bo0"},{"input_id":"366ec79d22fcb948i1","output_id":"366ec79d20aa644bo0"},{"input_id":"366ec79eb5af0e44i2","output_id":"366ec79dae5faa49o0"},{"input_id":"366ec79dae5faa49i2","output_id":"366ec79d22fcb948o0"},{"input_id":"366ec79e75d40c46i1","output_id":"366ec79d26478a41o0"},{"input_id":"366ec79ea3d4c64fi1","output_id":"366ec79e3d520747o0"},{"input_id":"366ec79c7fcd2144i1","output_id":"366ec79e90e8bd46o0"},{"input_id":"366ec79c7fcd2144i2","output_id":"366ec79e90e8bd46o0"},{"input_id":"366ec79e90e8bd46i2","output_id":"366ec79eb5af0e44o0"},{"input_id":"366ec79c7fcd2144i0","output_id":"366ec79eb5b45b48o0"},{"input_id":"366ec79d22fcb948i2","output_id":"366ec79eb7ea3e48o0"},{"input_id":"366ec79d4489b44bi0","output_id":"366ec79e5ad34e42o0"},{"input_id":"366ec79ce8c59245i2","output_id":"366ec79e325c7843o0"},{"input_id":"366ec79e4e76b242i1","output_id":"366ec79ea3d4c64fo0"},{"input_id":"366ec79eb5af0e44i1","output_id":"366ec79ea3d4c64fo0"},{"input_id":"366ec79eb5af0e44i0","output_id":"366ec79ea3d4c64fo1"},{"input_id":"366ec79c521fca40i1","output_id":"366ec79e75d40c46o0"},{"input_id":"366ec79d8e381a44i0","output_id":"366ec79e75d40c46o0"},{"input_id":"366ec79d22fcb948i0","output_id":"366ec79e75d40c46o0"},{"input_id":"366ec79d26478a41i1","output_id":"366ec79e9cd2444ao0"},{"input_id":"366ec79d26478a41i2","output_id":"366ec79e9cd2444ao0"},{"input_id":"366ec79e9cd2444ai0","output_id":"366ec79e4e76b242o0"},{"input_id":"366ec79d26478a41i0","output_id":"366ec79e4e76b242o1"},{"input_id":"366ec79e9cd2444ai1","output_id":"366ec79e4e76b242o1"}]}}}

Once again, this still counts by game frames instead of by seconds, so it will always output consistently relative to the game’s framerate (I’m pretty sure this is how the old timers worked but now they are changed to output based on the real-world time regardless of the framerate).

I have also made a special version of this frame timer that is set to Repeat Forever, and the code is more optimized because then the repeat count part is unnecessary:
Frame Timer Repeat Forever

Frame Timer (Repeat Forever) Code
{"data":{"behavior":{"v":"2","nodes":[{"inputCount":6,"outputCount":1,"name":"FrameTimer RepeatForever","behaviorType":"logic.NodeGroup","x":180,"y":80,"id":"3671b0e757c1ea48","notes":"You need to connect an Always behavior to the Always input here in order for this to work (but make sure the Always behavior is below any other behaviors that set this timer's properties),\nThis timer counts by frames instead of seconds, so it always is consistent with the game's framerate, not the real life time. \rThis version of the Frame Timer will repeat forever---it has no limit on how many times it will output once started. (So there is no Repeat input or Done output.)","n_o":1,"isMenuItem":false},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":180,"y":96,"group":"3671b0e757c1ea48","id":"3671b0e76e9d2a40","portId":"3671b0e757c1ea48i0","tag":"Delay","dataType":2},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":180,"y":160,"group":"3671b0e757c1ea48","id":"3671b0e7dc9b084c","portId":"3671b0e757c1ea48i1","tag":"Pause","dataType":2},{"expression":"(B%A)==0?1:0","default0":30,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":2,"version":2,"tag":"Frame Delay","inputCount":3,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":900,"y":256,"group":"3671b0e757c1ea48","id":"3671b0e8c5d37b4c"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":1260,"y":216,"group":"3671b0e757c1ea48","id":"3671b0e868d37a40","startVal":0,"tag":"Output Number","roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":360,"y":288,"group":"3671b0e757c1ea48","id":"3671b0e841480142","startVal":0,"tag":"Reset","roundMode":1},{"inputCount":1,"outputCount":0,"name":"Bundle Output","behaviorType":"logic.NodeGroupOutput","x":1440,"y":240,"group":"3671b0e757c1ea48","id":"3671b0e80c48c848","portId":"3671b0e757c1ea48o0","tag":"Out#","dataType":2},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":180,"y":224,"group":"3671b0e757c1ea48","id":"3671b0e83f0a7641","portId":"3671b0e757c1ea48i2","tag":"Resume","dataType":2},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":180,"y":288,"group":"3671b0e757c1ea48","id":"3671b0e821805647","portId":"3671b0e757c1ea48i3","tag":"Reset","dataType":2},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":180,"y":352,"group":"3671b0e757c1ea48","id":"3671b0e85d6ab64e","portId":"3671b0e757c1ea48i4","tag":"Start","dataType":2},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":540,"y":336,"group":"3671b0e757c1ea48","id":"3671b0e88c59fb40","_startVal":1,"dataType":2},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":360,"y":376,"group":"3671b0e757c1ea48","id":"3671b0e8dfd4394e","_startVal":0,"dataType":2},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":720,"y":296,"group":"3671b0e757c1ea48","id":"3671b0e8a95eaa4e","startVal":0,"tag":"Frame Number","roundMode":1},{"expression":"Math.round((Math.max(A,1)),1)","default0":0,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":1,"version":2,"tag":"Nearest Positive Integer Excluding 0","inputCount":2,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":360,"y":96,"group":"3671b0e757c1ea48","id":"3671b0e9fd549344"},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":180,"y":416,"group":"3671b0e757c1ea48","id":"3671b0e9d65c1b40","portId":"3671b0e757c1ea48i5","tag":"Always","dataType":2},{"gateVal":1,"mode":"equal to","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter2","x":1080,"y":272,"group":"3671b0e757c1ea48","id":"3671b0e9bdf59847"}],"links":[{"input_id":"3671b0e9fd549344i0","output_id":"3671b0e76e9d2a40o0"},{"input_id":"3671b0e9fd549344i1","output_id":"3671b0e76e9d2a40o0"},{"input_id":"3671b0e88c59fb40i0","output_id":"3671b0e7dc9b084co0"},{"input_id":"3671b0e9bdf59847i1","output_id":"3671b0e8c5d37b4co0"},{"input_id":"3671b0e80c48c848i0","output_id":"3671b0e868d37a40o0"},{"input_id":"3671b0e868d37a40i0","output_id":"3671b0e841480142o0"},{"input_id":"3671b0e8a95eaa4ei0","output_id":"3671b0e841480142o0"},{"input_id":"3671b0e88c59fb40i1","output_id":"3671b0e841480142o0"},{"input_id":"3671b0e88c59fb40i1","output_id":"3671b0e83f0a7641o0"},{"input_id":"3671b0e841480142i1","output_id":"3671b0e821805647o0"},{"input_id":"3671b0e8dfd4394ei0","output_id":"3671b0e821805647o0"},{"input_id":"3671b0e841480142i1","output_id":"3671b0e85d6ab64eo0"},{"input_id":"3671b0e8dfd4394ei1","output_id":"3671b0e85d6ab64eo0"},{"input_id":"3671b0e8a95eaa4ei2","output_id":"3671b0e88c59fb40o0"},{"input_id":"3671b0e88c59fb40i2","output_id":"3671b0e8dfd4394eo0"},{"input_id":"3671b0e8c5d37b4ci1","output_id":"3671b0e8a95eaa4eo0"},{"input_id":"3671b0e8c5d37b4ci2","output_id":"3671b0e8a95eaa4eo0"},{"input_id":"3671b0e8c5d37b4ci0","output_id":"3671b0e9fd549344o0"},{"input_id":"3671b0e8dfd4394ei2","output_id":"3671b0e9d65c1b40o0"},{"input_id":"3671b0e868d37a40i2","output_id":"3671b0e9bdf59847o0"}]}}}

The biggest difference with these is that the Always trigger is no longer inside the bundle, so (after supplying it yourself) you can actually make sure that it will input only after all of the other trigger behaviors that set the timer’s properties. In other words because Flowlab evaluates triggers from left to right (with triggers that share an X coordinate being evaluated from top to bottom), the Always must be evaluated after the other triggers that set this timer’s properties, so now you can be sure that that is actually happening because the Always is outside of the bundle with the rest of the triggers.

3 Likes

@thebrickccentric
Um… would it be possible to make a fps timer in the corner of the screen that displays how much fps the game is running at?

2 Likes

Galactic made it already

It’s basically just an Always → (+)Number
And then a timer set to 1 second resetting the number

Thx

That’s a cool example, but it doesn’t output every frame and it’s only accurate to the whole frame.
If you’re looking for the fps of the screen rendering the game, then the performamce metrics output that (there’s no way to output it through code since the code is capped at 30 fps while the screen’s rendering is not).

If you want an fps counter that outputs the actual fps that the code is running at (every frame, and is accurate to many decimal places), then here:

{"data":{"behavior":{"v":"2","nodes":[{"inputCount":0,"outputCount":0,"name":"FPS Accurate Counter","behaviorType":"logic.NodeGroup","x":-270,"y":-264,"group":"","id":"41a074f906b7e545","isMenuItem":false},{"inputCount":0,"outputCount":1,"name":"Always","behaviorType":"logic.triggers.Always","x":-810,"y":-296,"group":"41a074f906b7e545","id":"41a074f963783043"},{"inputCount":4,"outputCount":4,"name":"Label","behaviorType":"logic.hud.Label2","x":90,"y":-200,"group":"41a074f906b7e545","id":"41a074fa965f074f","text":"0","textColor":0,"fontName":"oduda","scale":10,"textAlign":"left","maxWidth":0,"xO":78,"yO":150,"pin":false,"alpha":100,"kerning":0},{"inputCount":4,"outputCount":4,"name":"Label","behaviorType":"logic.hud.Label2","x":90,"y":-328,"group":"41a074f906b7e545","id":"41a074faba1c7041","text":"FPS:","textColor":0,"fontName":"oduda","scale":10,"textAlign":"left","maxWidth":0,"xO":7,"yO":149,"pin":false,"alpha":100,"kerning":0},{"inputCount":1,"outputCount":4,"name":"Clock","behaviorType":"logic.components.Clock","x":-630,"y":-304,"group":"41a074f906b7e545","id":"41a074fae47c9142","fs":true},{"expression":"B-A","default0":0,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":2,"version":2,"tag":"Time Difference","inputCount":3,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":-270,"y":-296,"group":"41a074f906b7e545","id":"41a074fa285df548"},{"inputCount":2,"outputCount":2,"name":"Toggle","behaviorType":"logic.logic.FlipFlop","x":-450,"y":-296,"group":"41a074f906b7e545","id":"41a074fb7a8c7248","loop":false,"initialState":0},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":-90,"y":-352,"group":"41a074f906b7e545","id":"41a074fb78a2e747","startVal":0,"tag":"Previous Time","roundMode":1},{"expression":"1/A","default0":0,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":1,"version":2,"tag":"Per Second","inputCount":2,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":-90,"y":-224,"group":"41a074f906b7e545","id":"41a074fb1e8aea41"}],"links":[{"input_id":"41a074fae47c9142i0","output_id":"41a074f963783043o0"},{"input_id":"41a074fb7a8c7248i1","output_id":"41a074fae47c9142o3"},{"input_id":"41a074fb78a2e747i1","output_id":"41a074fa285df548o0"},{"input_id":"41a074fb1e8aea41i0","output_id":"41a074fa285df548o0"},{"input_id":"41a074fb1e8aea41i1","output_id":"41a074fa285df548o0"},{"input_id":"41a074fa285df548i0","output_id":"41a074fb7a8c7248o0"},{"input_id":"41a074fb7a8c7248i0","output_id":"41a074fb7a8c7248o0"},{"input_id":"41a074fb78a2e747i0","output_id":"41a074fb7a8c7248o1"},{"input_id":"41a074fa285df548i1","output_id":"41a074fb7a8c7248o1"},{"input_id":"41a074fa285df548i2","output_id":"41a074fb7a8c7248o1"},{"input_id":"41a074fa285df548i0","output_id":"41a074fb78a2e747o0"},{"input_id":"41a074fa965f074fi0","output_id":"41a074fb1e8aea41o0"}]}}}
1 Like