Thread: [REPP]Help

Results 1 to 9 of 9
  1. #1 [REPP]Help 
    Catherby Developer
    Mini Slurpee's Avatar
    Join Date
    Apr 2011
    Posts
    747
    Thanks given
    80
    Thanks received
    86
    Rep Power
    31
    okay, so basically i'm making a code that would exchanged the fish you have into your inventory into noted, but i want it so when you click and npc it will automatically take ALL your fish insted of clicking 28 times..
    NOTE: SOMEON RELEASED THIS IN SNIPPETS. I WANT TO IMPROVE IT.
    Code:
    	public void tradeFish() { 
    	     	c.getItems().addItem(318, c.getItems().getItemAmount(317));
    		    c.getItems().deleteItem(317, c.getItems().getItemAmount(317));
    		 	c.sendMessage("You give your fish to the fisherman and he notes them for you.");
    				}
    Attached image
    “I have not failed, I've just found 10,000 ways that won't work.”
    “Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”
    Reply With Quote  
     

  2. #2  
    Extreme Donator


    Join Date
    Dec 2007
    Posts
    649
    Thanks given
    117
    Thanks received
    61
    Rep Power
    105
    What you want to add dialogue? Explain what you want to improve
    Reply With Quote  
     

  3. #3  
    Catherby Developer
    Mini Slurpee's Avatar
    Join Date
    Apr 2011
    Posts
    747
    Thanks given
    80
    Thanks received
    86
    Rep Power
    31
    Quote Originally Posted by sircarl3 View Post
    What you want to add dialogue? Explain what you want to improve
    because right now basically, to exchange your fish for noted you have to click the npc 28 times, or the amount of fish you have in your inventory to note them.
    i want to make it so you click him once and he exchanges ALL your fish for notedfish automatically instantly.
    Attached image
    “I have not failed, I've just found 10,000 ways that won't work.”
    “Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”
    Reply With Quote  
     

  4. #4  
    Registered Member thatsgodzkill's Avatar
    Join Date
    May 2011
    Age
    28
    Posts
    159
    Thanks given
    0
    Thanks received
    6
    Rep Power
    3
    Make a method that checks the inventory for how much of an item you have in it?
    Reply With Quote  
     

  5. #5  
    Catherby Developer
    Mini Slurpee's Avatar
    Join Date
    Apr 2011
    Posts
    747
    Thanks given
    80
    Thanks received
    86
    Rep Power
    31
    Quote Originally Posted by thatsgodzkill View Post
    Make a method that checks the inventory for how much of an item you have in it?
    I don't quite know how to do that, or i wouldn't be here right now.
    Attached image
    “I have not failed, I've just found 10,000 ways that won't work.”
    “Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”
    Reply With Quote  
     

  6. #6  
    Extreme Donator


    Join Date
    Dec 2007
    Posts
    649
    Thanks given
    117
    Thanks received
    61
    Rep Power
    105
    Quote Originally Posted by Mini Slurpee View Post
    because right now basically, to exchange your fish for noted you have to click the npc 28 times, or the amount of fish you have in your inventory to note them.
    i want to make it so you click him once and he exchanges ALL your fish for notedfish automatically instantly.
    Yeah you put that in the original post. I feel stupid

    It looks like it would work the way it's setup.

    Code:
    public int getItemAmount(int ItemID) {
    		int itemCount = 0;
    		for (int i = 0; i < c.playerItems.length; i++) {
    			if((c.playerItems[i] - 1) == ItemID) {
    				itemCount += c.playerItemsN[i];
    			}
    		}
    		return itemCount;
    	}
    There's the method

    See what this does for you. Its pretty much the same thing but hey, it wont hurt to try I guess

    Code:
    	public void tradeFish() { 
                    int fish = c.getItems().getItemAmount(317);
    	     	c.getItems().deleteItem(317, fish);
    		    c.getItems().addItem(318, fish);
    		 	c.sendMessage("You give your fish to the fisherman and he notes them for you.");
    				}
    Little more concise. Also it makes sense to delete the items before you add them.
    Reply With Quote  
     

  7. Thankful user:


  8. #7  
    Catherby Developer
    Mini Slurpee's Avatar
    Join Date
    Apr 2011
    Posts
    747
    Thanks given
    80
    Thanks received
    86
    Rep Power
    31
    Quote Originally Posted by sircarl3 View Post
    Yeah you put that in the original post. I feel stupid

    It looks like it would work the way it's setup.

    Code:
    public int getItemAmount(int ItemID) {
    		int itemCount = 0;
    		for (int i = 0; i < c.playerItems.length; i++) {
    			if((c.playerItems[i] - 1) == ItemID) {
    				itemCount += c.playerItemsN[i];
    			}
    		}
    		return itemCount;
    	}
    There's the method
    isn't that already in my code?, but it's not taking all the items at once and turning into noted ..
    Attached image
    “I have not failed, I've just found 10,000 ways that won't work.”
    “Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”
    Reply With Quote  
     

  9. #8  
    Extreme Donator


    Join Date
    Dec 2007
    Posts
    649
    Thanks given
    117
    Thanks received
    61
    Rep Power
    105
    Read that post I edited it above.
    Reply With Quote  
     

  10. #9  
    Catherby Developer
    Mini Slurpee's Avatar
    Join Date
    Apr 2011
    Posts
    747
    Thanks given
    80
    Thanks received
    86
    Rep Power
    31
    got it to work, but thanks anyway & repp+
    Attached image
    “I have not failed, I've just found 10,000 ways that won't work.”
    “Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”
    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] Help with this please repp++
    By Mini Slurpee in forum Help
    Replies: 1
    Last Post: 08-08-2011, 08:13 AM
  2. Will repp
    By Huey in forum Software
    Replies: 7
    Last Post: 04-25-2009, 01:08 AM
  3. PLEASE HELP Repp++
    By massacre215 in forum Help
    Replies: 2
    Last Post: 01-16-2009, 05:01 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •