Jump to content
Viston

Set a final radius from player position

Recommended Posts

5 minutes ago, Visty said:

So upon starting a script, I want the user to be able to enter a radius in form in integer. This will set a radius for e.g 15 tiles surrounding my player at the moment. The radius should be set, and never changed.

How would I approach this with the api?

In onStart, create a custom GUI or just use a dialogue to get the radius value from the user.

Then get the Area for that radius using:

myPlayer().getArea(radius)

And store it globally.

Edited by Explv
  • Like 3
Link to comment
Share on other sites

If you're looking for a simple solution and don't want to go through the hassle of creating your own GUI, and this is the only data you want to input, consider using a JOptionPane. Just remember to check the data that's inputted and ensure that it's valid, and if not pop the option pane up again!

-Apa

  • Like 2
Link to comment
Share on other sites

3 hours ago, Apaec said:

If you're looking for a simple solution and don't want to go through the hassle of creating your own GUI, and this is the only data you want to input, consider using a JOptionPane. Just remember to check the data that's inputted and ensure that it's valid, and if not pop the option pane up again!

-Apa

Thank you for your post. I've sorted out the GUI. Just wanted to know how to get the area, store it in a variable, then access it to my tasks. Nevertheless, I appreciate your post :doge:

  • Like 1
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...