To make the timedgoto macro work in SugarCube, what you need is to replace state.history[0] with state.active, mostly. Just change it as follows:
version.extensions.timedgotoMacro={ major:1,minor:1,revision:1 /*SugarCube version*/ }; macros["goto"]=macros["timedgoto"]={ timer:null,handler:function(a,b,c,d){ function cssTimeUnit(s){ if(typeof s=="string"){ if(s.slice(-2).toLowerCase()=="ms"){ return Number(s.slice(0,-2))||0; } else{ if(s.slice(-1).toLowerCase()=="s"){ return Number(s.slice(0,-1))*1000||0; } } } throwError(a,s+" isn't a CSS time unit"); return 0; } var t,d,m,s; t=c[c.length-1]; d=d.fullArgs(); m=0; if(b!="goto"){ d=d.slice(0,d.lastIndexOf(t)); m=cssTimeUnit(t); } d=eval(Wikifier.parse(d)); if(d+""){ if(this.timer){ clearTimeout(this.timer); } s=state.active.title; this.timer=setTimeout(function(){ if(state.active.title==s){ state.display(d,a); } },m); } } };
I'm not sure how I technically managed to make this work, but it's all explained in SugarCube's API documentation.