Jump to content

problem accessing player information in gui


roguehippo

Recommended Posts

hey guys, im having a bit of a problem when it comes to accessing the players information from inside of the gui class. currently it gives me a null pointer when i use something like myPlayer().getPosition even though i have called 

 

MethodProvider m;
public Gui (MethodProvider m){
       this.m = m;
   } 
 
the exact code causing a problem is here:
 
 FightArea = m.myPlayer().getArea(Integer.parseInt(TileRadius.getText()));
 
its just making an area with a defined radius from a textfield.
 
Link to comment
Share on other sites

Just a shot outta the dark... but are you initializing your GUI before the player is logged in?

 

 

umm i think the player is ussually logged in but this happens no matter what

I had the same issue when making my script.

Read this thread

http://osbot.org/forum/topic/104466-grabbing-myplayers-start-area-with-gui/ 

ohh i think thats exactly what my problem is, i have to pass "script" in with the gui? is that as simple as just adding in the Gui(Script script) instead of gui(). How should i add the script into the gui when im calling it from onStart()?

Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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...