Jump to content
Athylus

Threading paint before OnLoop

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...