Alakazizam Posted yesterday at 01:35 AM Share Posted yesterday at 01:35 AM 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 yesterday at 06:55 AM Share Posted yesterday at 06:55 AM 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 yesterday at 07:37 AM Author Share Posted yesterday at 07:37 AM 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 yesterday at 07:52 AM Share Posted yesterday at 07:52 AM 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 yesterday at 08:09 AM Author Share Posted yesterday at 08:09 AM 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 yesterday at 02:58 PM Share Posted yesterday at 02:58 PM 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 19 hours ago Author Share Posted 19 hours ago 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 16 hours ago Share Posted 16 hours ago Any time Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted 12 hours ago Share Posted 12 hours ago 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...