Thread: Simple Switch Statement

Results 1 to 5 of 5
  1. #1 Simple Switch Statement 
    Registered Member
    TheElveAge's Avatar
    Join Date
    Sep 2009
    Posts
    938
    Thanks given
    26
    Thanks received
    60
    Rep Power
    124
    I have this.
    Code:
        public int GetNPCBlockAnim(int npcid) {
            return (int server.npc.animNumber) {//i don't know this one
                case 90:
                case 91:
                    return 261;
                default:
                    return 1613;//1834 was default
            }
        }

    Does anyone know what The server.npc.animNumber should be?

    Or am i even doing this correct?
    Reply With Quote  
     

  2. #2  
    Donator

    Ecstasy's Avatar
    Join Date
    Sep 2008
    Age
    29
    Posts
    5,031
    Thanks given
    324
    Thanks received
    596
    Rep Power
    843
    Hmm well first of all, that's a return statement, not a switch statement.
    A switch statement would be like this:

    Code:
    switch(integerName) {
    }
    But in this situation, I would switch the NPC id, and return the emote the NPC should use: So something like this.

    Code:
    	public class AnimationHandler {
    		public int getAnimationId(int npcId) {
    			switch (npcId) {
    			case 90:
    			case 91:
    				return 261;
    			default:
    				return 1613;// 1834 was default
    			}
    		}
    	}
    Then to call it simple use:

    Code:
    AnimationHandler.getAnimationId(npcId);
    wherever you're called the block emote ID. Enjoy

    Reply With Quote  
     

  3. #3  
    Registered Member
    TheElveAge's Avatar
    Join Date
    Sep 2009
    Posts
    938
    Thanks given
    26
    Thanks received
    60
    Rep Power
    124
    Lol yes, return statement, i have been reading to many statments today. Thanks for helping me tho.

    Also your not returning the emote, your not returning anything

    EDIT: How would i return the emote?
    Reply With Quote  
     

  4. #4  
    Donator

    Ecstasy's Avatar
    Join Date
    Sep 2008
    Age
    29
    Posts
    5,031
    Thanks given
    324
    Thanks received
    596
    Rep Power
    843
    Code:
    				return 261;
    That's returning it. You would use like

    Code:
    Npc.yourNpcEmoteMethod(AnimationHandler.getAnimationId(npcId));

    Reply With Quote  
     

  5. #5  
    Registered Member
    TheElveAge's Avatar
    Join Date
    Sep 2009
    Posts
    938
    Thanks given
    26
    Thanks received
    60
    Rep Power
    124
    Quote Originally Posted by 'Ecstasy ?! View Post
    Code:
    				return 261;
    That's returning it. You would use like

    Code:
    Npc.yourNpcEmoteMethod(AnimationHandler.getAnimationId(npcId));
    Read it wrong. Thanks.
    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
  •