Twin Posted March 3, 2015 Share Posted March 3, 2015 So basically, I'm running into an issue with an or statement breaking my script, so I figured i'd try instead of having 2 areas, to get rid of the or statement and make it so only 1 area exist. basically I have at the onStart() String ironOrCoal = JOptionPane.showInputDialog("What area should we be at? c = coal, iron = i"); and then somewhere along the code i'll have if(ironOrCoal.contains©) { Area MINEAREA = new Area(x,y,b,c); } else Area MINEAREA = new Area(d,e,q,r); this isn't the exact code, just an example of what I had. So I thought this should work, but it would tell me all around the code that it didn't know what MINEAREA is, and that it was unused. So on the onStart area I added a private Area MINEAREA; but that did nothing either, still wouldnt let me use it anywhere. So I messed around with it and Still couldn't figure it out. Is it getting deleted once it leaves the if statement? like do I need to make a MINEAREA and have all its cordinates be 0, then in the if statement change it so it equals the cordinates based on user input? So confused with this issue. Quote Link to comment Share on other sites More sharing options...
Isolate Posted March 3, 2015 Share Posted March 3, 2015 final Area COAL = blah blah blah; final Area IRON = blah blah blah; Area mine = null; if(COAL.contains(myPlayer()){ mine = COAL; }else if(IRON.contains(myPlayer()){ mine = IRON; } Quote Link to comment Share on other sites More sharing options...
Twin Posted March 3, 2015 Author Share Posted March 3, 2015 final Area COAL = blah blah blah; final Area IRON = blah blah blah; Area mine = null; if(COAL.contains(myPlayer()){ mine = COAL; }else if(IRON.contains(myPlayer()){ mine = IRON; } oh im a dumbass Area is a final lol, that might be why. You always help my aass I feel like I owe you. Anyway, so basically this has a final set for area, and a final set for iron, and it stores it into the area mine which has nothing in it? Quote Link to comment Share on other sites More sharing options...
Isolate Posted March 3, 2015 Share Posted March 3, 2015 oh im a dumbass Area is a final lol, that might be why. You always help my aass I feel like I owe you. Anyway, so basically this has a final set for area, and a final set for iron, and it stores it into the area mine which has nothing in it? something is only final if you don't intend on changing it. The Area bits would go where all your other variables go and the if would go in your on start. the area your script will use in this case is 'mine' which will be defined by which area you are standing in on start. if you want it to be more complicated you could if you're not in an area on start it will wait until you're in one of these two before starting. Quote Link to comment Share on other sites More sharing options...
Twin Posted March 3, 2015 Author Share Posted March 3, 2015 something is only final if you don't intend on changing it. The Area bits would go where all your other variables go and the if would go in your on start. the area your script will use in this case is 'mine' which will be defined by which area you are standing in on start. if you want it to be more complicated you could if you're not in an area on start it will wait until you're in one of these two before starting. Sorry went afk for a bit. Eclipse is yelling at me to change final Area to final int, and just underlines with red all the numbers I have after the =. final Area COAL = 1,2,3,4; //is that setup right? Quote Link to comment Share on other sites More sharing options...
Precise Posted March 3, 2015 Share Posted March 3, 2015 Sorry went afk for a bit. Eclipse is yelling at me to change final Area to final int, and just underlines with red all the numbers I have after the =. final Area COAL = 1,2,3,4;//is that setup right? private final Area IRON = new Area(1,2,3,4); Quote Link to comment Share on other sites More sharing options...
Isolate Posted March 3, 2015 Share Posted March 3, 2015 Sorry went afk for a bit. Eclipse is yelling at me to change final Area to final int, and just underlines with red all the numbers I have after the =. final Area COAL = 1,2,3,4; //is that setup right? private final Area IRON = new Area(1,2,3,4); More people should use polygon areas. Quote Link to comment Share on other sites More sharing options...
Precise Posted March 3, 2015 Share Posted March 3, 2015 More people should use polygon areas.Why are you telling me that when you said Area above? Quote Link to comment Share on other sites More sharing options...
Isolate Posted March 3, 2015 Share Posted March 3, 2015 Why are you telling me that when you said Area above? General statement ^_^ Quote Link to comment Share on other sites More sharing options...
Precise Posted March 3, 2015 Share Posted March 3, 2015 General statement ^_^ Yes I agree ^_^ Quote Link to comment Share on other sites More sharing options...