March 18, 20187 yr Quick question on multithreading. My script uses a GUI which has two options: What tree type to cut and another dropbown menu for how big of an area you want to cut in. Now when the area size if being adjusted I want to paint it, while the main scriptloop has not started yet. How can I implement such a function?
March 18, 20187 yr 14 minutes ago, Athylus said: Quick question on multithreading. My script uses a GUI which has two options: What tree type to cut and another dropbown menu for how big of an area you want to cut in. Now when the area size if being adjusted I want to paint it, while the main scriptloop has not started yet. How can I implement such a function? The onPaint method already runs on another Thread. The main Script loop is another Thread which starts after the onStart.
March 18, 20187 yr OnPaint should be called consistently from when you start the script to when you end it; it has nothing to do with onLoop So in your onPaint, perhaps have a call to your area painting class or gui class (or whatever you're doing), which asks for an optional wrapped area for example. Best Apa
March 18, 20187 yr There is nothing that is going to interfere with your GUI. The script hasn't started so if your GUI is open and a user is adjusting the area, the area on minimap will also adjust accordingly. After the script starts, the thread that draws is separate from the onLoop thread, there still isn't any interference.
March 18, 20187 yr Author Except I have this in my onStart for my GUI: synchronized(lock){ try { lock.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } Which is notified by my start button on GUI
March 19, 20187 yr 21 hours ago, Athylus said: Except I have this in my onStart for my GUI: synchronized(lock){ try { lock.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } Which is notified by my start button on GUI Why would you do that ... ^^
Create an account or sign in to comment