Thread: error using ints and booleans from c.j in a diff class

Results 1 to 4 of 4
  1. #1 error using ints and booleans from c.j in a diff class 
    Registered Member sigmą's Avatar
    Join Date
    Dec 2009
    Posts
    273
    Thanks given
    10
    Thanks received
    2
    Rep Power
    1
    hi im using the original whitescape and im having trouble using ints and booleans from my client class in a new class i made for crafting

    methods such as sendmessage work fine, and for some reason, the boolean addItem works but no deleteItem.

    here is my crafting class

    Code:
    package src.content.skills;
    
    import src.client;
    
    public class Crafting { 
    
    	public static int gem[] = {1617, 1619, 1621, 1623, 1631};
    	
    	public static void cutGem(client c) {
    		if((c.itemUsed == 1755) && (c.useWith == gem)){
    			c.deleteItem(gem, 1);
    			c.addItem(995, 100);
    		}else{
    			c.sendMessage("You need a chisel to cut this.");
    		}
    	}
    
    }
    errors
    Code:
    compiling...
    .\src\content\skills\Crafting.java:10: cannot find symbol
    symbol  : variable itemUsed
    location: class src.client
                    if((c.itemUsed == 1755) && (c.useWith == gem)){
                         ^
    .\src\content\skills\Crafting.java:10: cannot find symbol
    symbol  : variable useWith
    location: class src.client
                    if((c.itemUsed == 1755) && (c.useWith == gem)){
                                                 ^
    .\src\content\skills\Crafting.java:11: cannot find symbol
    symbol  : method deleteItem(int[],int)
    location: class src.client
                            c.deleteItem(gem, 1);
                             ^
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    3 errors
    Finished!
    Press any key to continue . . .
    as you can see addItem works fine but deleteItem doesnt. and then the ints in the if statement just plain out dont work
    did you know

    if a mosquito is biting your bicep and you flex, it explodes.

    if you break your back, you get a boner


    cool stuff
    Reply With Quote  
     

  2. #2  
    Banned

    Join Date
    Jul 2008
    Posts
    2,056
    Thanks given
    26
    Thanks received
    98
    Rep Power
    0
    Can't find symbol - Aka your method cannot be found in client. AKA it's not public, or the method arguements don't match
    Reply With Quote  
     

  3. #3  
    Registered Member sigmą's Avatar
    Join Date
    Dec 2009
    Posts
    273
    Thanks given
    10
    Thanks received
    2
    Rep Power
    1
    public static void cutGem(client c) {
    did you know

    if a mosquito is biting your bicep and you flex, it explodes.

    if you break your back, you get a boner


    cool stuff
    Reply With Quote  
     

  4. #4  
    Banned

    Join Date
    Jul 2008
    Posts
    2,056
    Thanks given
    26
    Thanks received
    98
    Rep Power
    0
    It's because you are calling 'gem' when you have declared gem[]. Just use an enhanced for loop to find which id you are using and call it instead
    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

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •