|
@@ -1,10 +1,30 @@
|
|
|
::MacroGT[widget]
|
|
|
<<widget 'gt'>>
|
|
|
|
|
|
-
|
|
|
+ <<set _recursion_limit to 3>>
|
|
|
|
|
|
<<set _destintation = _args[0]>>
|
|
|
|
|
|
+ <<if !$gt_history>>
|
|
|
+ <<set $gt_history to {}>>
|
|
|
+ <</if>>
|
|
|
+ <<set _ts to Math.floor(Date.now() / 10000)>>
|
|
|
+ <<if !$gt_history[_ts]>>
|
|
|
+ <<set $gt_history[_ts] to {}>>
|
|
|
+ <</if>>
|
|
|
+ <<if !$gt_history[_ts][_destintation]>>
|
|
|
+ <<set $gt_history[_ts][_destintation] to 0>>
|
|
|
+ <</if>>
|
|
|
+ <<set $gt_history[_ts][_destintation] += 1>>
|
|
|
+
|
|
|
+ <<set _temp_history to {}>>
|
|
|
+ <<for _time,_history range $gt_history>>
|
|
|
+ <<if _time > _ts - 10>>
|
|
|
+ <<set _temp_history[_time] = _history>>
|
|
|
+ <</if>>
|
|
|
+ <</for>>
|
|
|
+ <<set $gt_history to _temp_history>>
|
|
|
+
|
|
|
<!--<<if !$location_var>>-->
|
|
|
<<set $location_var to {}>>
|
|
|
<!--<</if>>-->
|
|
@@ -17,7 +37,11 @@
|
|
|
<<set $location_var[_destintation][(_i-1)] to _args[_i]>>
|
|
|
<</for>>
|
|
|
|
|
|
- <<run console.log("GT: "+_args[0],$location_var[_destintation])>>
|
|
|
+ <<run console.log("GT: "+_args[0],$location_var[_destintation],$gt_history)>>
|
|
|
|
|
|
- <<goto _destintation>>
|
|
|
+ <<if $gt_history[_ts][_destintation] <= _recursion_limit>>
|
|
|
+ <<goto _destintation>>
|
|
|
+ <<else>>
|
|
|
+ <<run console.error('RECURSION LIMIT REACHED')>>
|
|
|
+ <</if>>
|
|
|
<</widget>>
|