Thread: [PI] 2 Errors

Results 1 to 5 of 5
  1. #1 [PI] Error 
    Registered Member
    Join Date
    Aug 2013
    Posts
    134
    Thanks given
    25
    Thanks received
    2
    Rep Power
    19
    Here is the error:
    Code:
    src\server\model\players\ActionHandler.java:312: error: cannot find symbol
                    Chest.Open(itemId, c);
                               ^
      symbol:   variable itemId
      location: class ActionHandler
    
    Press any key to continue . . .
    Here is my Chest class
    Spoiler for Chest Class:
    Code:
    package server.model.players;
    
    import server.model.players.Client;
    import server.event.EventManager;
    import server.event.Event;
    import server.event.EventContainer;
    import server.util.Misc;
    import server.model.players.packets.ClickObject;
    
    /*
     * Author - Ferocious & Mod Loc ([email protected])
     * http://www.rune-server.org/members/ags 
     * http://www.rune-server.org/members/Ferocious
     */
    
    public class Chest {
    
    	public static boolean Canusebox = true;
    	
    	public static int Common [] = 
    	{1323, 1313, 1315, 1321, 1109, 1079, 1093, 1127, 10828, 3749, 1213, 1261, 
    	1333, 2440, 2436, 2442, 1704, 1725 }; // Add more item Id's
    	
    	public static int Uncommon [] = 
    	{4151, 4587, 4586, 9185, 11732, 4716, 4718, 4720, 4722, 4753, 4755, 
    	4757, 4759 }; // Add more item Id's
    	
    	public static int Rare [] = 
    	{11700, 11698, 773, 6585, 774, 11702, 11704, 
    	11706, 11708, 11690, 11690 }; // Add more item Id's
    
    	public static int GenerateMysteryChest(final Client c) {
    		 EventManager.getSingleton().addEvent(new Event() {
    			int BoxTimer = 2;
    			public void execute(EventContainer Box) {
    				Canusebox = false;
    				if (BoxTimer == 2) {
    					c.sendMessage("Opening the chest...");
    				}
    				if (BoxTimer == 0) {
    					int Random = Misc.random(100);
    					if (Random <= 71) {
    						c.getItems().addItem(Common[(int) (Math.random() * Common.length)], 1);
    						c.getItems().addItem(Common[(int) (Math.random() * Common.length)], 1);
    						c.getItems().addItem(Common[(int) (Math.random() * Common.length)], 1);
    						c.getItems().addItem(Common[(int) (Math.random() * Common.length)], 1);
    						c.sendMessage("You have recieved six @gre@common @bla@items.");
    					} else if (Random >= 72 && Random <= 92) {
    						c.getItems().addItem(Uncommon[(int) (Math.random() * Uncommon.length)], 1);
    						c.getItems().addItem(Uncommon[(int) (Math.random() * Uncommon.length)], 1);
    						c.getItems().addItem(Uncommon[(int) (Math.random() * Uncommon.length)], 1);
    						c.sendMessage("You have recieved three @yel@uncommon @bla@items.");
    					} else if (Random >= 93 && Random <= 100) {
    						c.getItems().addItem(Rare[(int) (Math.random() * Rare.length)], 1);
    						c.getItems().addItem(Rare[(int) (Math.random() * Rare.length)], 1);
    						c.sendMessage("You have recieved two @red@rare @bla@items.");
    					}
    				}
    				if (c == null || BoxTimer <= 0) {
    				   	Box.stop();
    					Canusebox = true;
                        return; 
    				}
    				if (BoxTimer >= 0) {
    					BoxTimer--;
    				}
    			}
    		}, 1000);
    		return Common[(int) (Math.random() * Common.length)];
    	}
    	
    	public static void Open(int itemID, Client c) {
    		if (c.objectId == 4126) {
    			if (c.getItems().freeSlots() > 1) {
    				if (Canusebox == true) {
    					c.chest = 1;
    					GenerateMysteryChest(c);
    				} else {
    					c.sendMessage("Please wait while your current process is finished.");
    				}
    			} else {
    				c.sendMessage("You need at least 2 slots to open this chest.");
    			}
    		}
    	}
    	
    }
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Aug 2013
    Posts
    134
    Thanks given
    25
    Thanks received
    2
    Rep Power
    19
    Bump-a-lump
    Reply With Quote  
     

  3. #3  
    Public Enemy #1

    Gynx's Avatar
    Join Date
    Oct 2013
    Age
    29
    Posts
    425
    Thanks given
    60
    Thanks received
    41
    Rep Power
    0
    Uh, try making the i Capitalized.

    Also, use Eclipse, it's easier.


    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Feb 2012
    Posts
    39
    Thanks given
    1
    Thanks received
    2
    Rep Power
    11
    You didn't declared the int itemid.
    You can fix this to give it a value so for example
    if it is like a magic box (id from mbox is 6199)
    it will be
    int itemId = 6199;
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    May 2013
    Posts
    1,169
    Thanks given
    28
    Thanks received
    133
    Rep Power
    53
    open(int itemId, Client c) make it open(Client c) as you're not even using the itemId int, then call it with Chest.open(c);

    Edit, actually.. change it to open(int objectId, Client c) to be less confusing and instead of doing

    if (c.objectId == 4126) make it if (objectId == 4126)
    So the integer is actually used, up to you tho

    Assuming you're calling the open void in actionhandler as you're using pi, just call it with Chest.open(objectType, c); or whatever your actionhandler uses as its objectId identifier
    If only I hadn't given you up, my life could've been different.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [pi] error with loading screen
    By rexz0rd in forum Help
    Replies: 1
    Last Post: 07-30-2010, 02:48 PM
  2. [PI] Error
    By Xuzk in forum Help
    Replies: 5
    Last Post: 07-26-2010, 11:31 AM
  3. Few PI errors
    By Arithium in forum Help
    Replies: 2
    Last Post: 06-28-2010, 12:18 AM
  4. [PI]Error: T1 - 123,0 - 36,36
    By Neekage in forum Help
    Replies: 1
    Last Post: 06-22-2010, 09:37 PM
  5. Some pi error??????
    By Oh my gawd in forum Help
    Replies: 20
    Last Post: 05-08-2009, 03:19 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •