Alakazizam Posted May 3 Share Posted May 3 When I home tele config 892 changes to what I'm assuming is some sort of game clock and I'm guessing its set up to either set that as what the clock currently is or what it needs to be before you can home tele again. Does anyone know how to get a reference to what that clock currently would be? Quote Link to comment Share on other sites More sharing options...
dubai Posted May 3 Share Posted May 3 I might be wrong but you could do something like: If widget exists and contains message(int 1-20 minutes) But another easy option could be to just store the time in memory from where you teleported and count down 20 mins? Quote Link to comment Share on other sites More sharing options...
Alakazizam Posted May 3 Author Share Posted May 3 38 minutes ago, dubai said: I might be wrong but you could do something like: If widget exists and contains message(int 1-20 minutes) But another easy option could be to just store the time in memory from where you teleported and count down 20 mins? I've never messed with the chat as widgets, I'll look into that. I usually use the onMessage() for anything having to do with chat. But I don't want to rely on storing it and having a timer because I'd worry about it not functioning as intended if I need to stop the script and start it back up for whatever reason. Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted May 3 Share Posted May 3 The time the last home teleport is saved in a config 892 if I remember correctly, so you can always check that config Quote Link to comment Share on other sites More sharing options...
Alakazizam Posted May 3 Author Share Posted May 3 15 minutes ago, Khaleesi said: The time the last home teleport is saved in a config 892 if I remember correctly, so you can always check that config Yeah, I got that much sorted out. I'm trying to figure out how to get whatever the current time is to compare it to the time that was set. I thought I found it but I can only figure out how to get my own system's time. Quote Link to comment Share on other sites More sharing options...
Czar Posted May 3 Share Posted May 3 Here, taken from my quester public int getSecondsLeftTeleportHome() { int lastTeleport = getConfigs().get(892); long lastTeleportSeconds = (long) lastTeleport * 60; Instant teleportExpireInstant = Instant.ofEpochSecond(lastTeleportSeconds).plus(Duration.ofMinutes(30)); Duration remainingTime = Duration.between(Instant.now(), teleportExpireInstant); return (int) remainingTime.getSeconds(); } 2 Quote Link to comment Share on other sites More sharing options...
Alakazizam Posted May 3 Author Share Posted May 3 6 hours ago, Czar said: Here, taken from my quester public int getSecondsLeftTeleportHome() { int lastTeleport = getConfigs().get(892); long lastTeleportSeconds = (long) lastTeleport * 60; Instant teleportExpireInstant = Instant.ofEpochSecond(lastTeleportSeconds).plus(Duration.ofMinutes(30)); Duration remainingTime = Duration.between(Instant.now(), teleportExpireInstant); return (int) remainingTime.getSeconds(); } Awesome, that got me squared away. Also taught me about 'Instant' so thanks for that too! 1 Quote Link to comment Share on other sites More sharing options...
Czar Posted May 4 Share Posted May 4 Any time Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted May 4 Share Posted May 4 13 hours ago, Czar said: Here, taken from my quester public int getSecondsLeftTeleportHome() { int lastTeleport = getConfigs().get(892); long lastTeleportSeconds = (long) lastTeleport * 60; Instant teleportExpireInstant = Instant.ofEpochSecond(lastTeleportSeconds).plus(Duration.ofMinutes(30)); Duration remainingTime = Duration.between(Instant.now(), teleportExpireInstant); return (int) remainingTime.getSeconds(); } Nice spoon Quote Link to comment Share on other sites More sharing options...