So, i just added the "$ thread" portions to the code below. In doing so, i was able elimate a quite significant lag spike. These functions pretty much all contain yml edits using skUtilities.
Fair enough, the lag is gone and im rather happy. The new additional lines of code however, are kinda bugging me. Is there any way to group stuff like that up so "$ thread" doesnt have to be put before every individual line? I'm having a hard time finding the appropriate documentation on this.
A workaround i've come up with, is to put all these function calls in a new master-function, so to say. But that would force me to export all variables, the data of the event, to the new function and i'd love to prevent having to do so.
Cheers peeps!
Fair enough, the lag is gone and im rather happy. The new additional lines of code however, are kinda bugging me. Is there any way to group stuff like that up so "$ thread" doesnt have to be put before every individual line? I'm having a hard time finding the appropriate documentation on this.
A workaround i've come up with, is to put all these function calls in a new master-function, so to say. But that would force me to export all variables, the data of the event, to the new function and i'd love to prevent having to do so.
Cheers peeps!
code_language.skript:
$ thread
addPlayerStats({_player}, "Holes", 1)
$ thread
addPlayerStats({_player}, "Strokes.Total", {_strokes})
$ thread
addPlayerStats({_player}, "Time.Total", {_time})
$ thread
addPlayerStats({_player}, "Courses.%{_course}%.Holes.%{_hole}%.Holes", 1)
$ thread
addPlayerStats({_player}, "Courses.%{_course}%.Holes.%{_hole}%.Strokes.Total", {_strokes})
$ thread
addPlayerStats({_player}, "Courses.%{_course}%.Holes.%{_hole}%.Time.Total", {_time})
$ thread
addPlayerStats({_player}, "Scores.Totals.%{_score}%", 1)
broadcast "&c%system milliseconds - {_t}% &7ms"
$ thread
recalculatePlayerStats({_player}, {_course}, {_hole})
delete yml nodes "Latest.Hole" of file "%{_playerfile}%"
$ thread
setPlayerStats({_player}, "Latest.Hole.Date", -1, "%now%")
$ thread
setPlayerStats({_player}, "Latest.Hole.Course", -1, {_course})
$ thread
setPlayerStats({_player}, "Latest.Hole.Hole", {_hole}, "")
$ thread
setPlayerStats({_player}, "Latest.Hole.Strokes", {_strokes}, "")
$ thread
setPlayerStats({_player}, "Latest.Hole.Time", {_time}, "")
$ thread
setPlayerStats({_player}, "Latest.Hole.Route", {_ball_route}, "")
$ thread
checkPersonalBest({_player}, {_course}, {_hole}, {_strokes}, {_time}, {_par})
$ thread
checkGlobalBest({_player}, {_course}, {_hole}, {_strokes}, {_time}, {_par})
$ thread
setGameStats({_game}, "Scores.%{_player}'s uuid%.ScoreTotal", ({_strokes_total} - {_par_current}))
$ thread
setGameStats({_game}, "Scores.%{_player}'s uuid%.StrokesCurrent", 0)
$ thread
setGameStats({_game}, "Scores.%{_player}'s uuid%.Strokes.%{_hole}%", {_strokes})
$ thread
setGameStats({_game}, "Scores.%{_player}'s uuid%.Times.%{_hole}%", {_time})
$ thread
setGameStats({_game}, "Scores.%{_player}'s uuid%.HolesCompleted", {_hole})
$ thread
addGameStats({_player}, "Scores.%{_player}'s uuid%.BallRouteTotal", {_ball_route})
$ thread
addGameStats({_player}, "Scores.%{_player}'s uuid%.EfficiencyTotal", ({_length} / {_ball_route}))