Thread: Switch

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1 Switch 
    Registered Member
    Sirloin's Avatar
    Join Date
    Feb 2012
    Age
    27
    Posts
    782
    Thanks given
    186
    Thanks received
    175
    Rep Power
    105
    What would go inside the switch to get it to work?
    Code:
    	public static enum ThingTypes {
    		REGULAR,
    		BLAH,
    		EXAMPLE,
    		NAME
    	}
    Code:
    	public static void getThingType(Player player) {
    		switch (inside here) {
    		case REGULAR:
    			player.sm("Loltest");
    		}
    	}
    I tried this, but it didn't work...
    Code:
    	public static void getThingType(Player player) {
    		switch (ThingTypes) {
    		case REGULAR:
    			player.sm("Loltest");
    		}
    	}
    'cause I'm dumb.
    Any help please?
    Reply With Quote  
     

  2. #2  
    Registered Member blayke's Avatar
    Join Date
    Feb 2012
    Posts
    99
    Thanks given
    20
    Thanks received
    0
    Rep Power
    11
    can you explain more on what your trying to do?
    Reply With Quote  
     

  3. #3  
    Super Donator

    Batukka's Avatar
    Join Date
    Oct 2011
    Posts
    2,433
    Thanks given
    86
    Thanks received
    342
    Rep Power
    496
    You can use only int in switch
    Reply With Quote  
     

  4. Thankful user:


  5. #4  
    Banned

    Join Date
    Aug 2012
    Posts
    611
    Thanks given
    88
    Thanks received
    118
    Rep Power
    0
    Create an instance of ThingTypes and add that into the switch parameters.

    Example: private ThingTypes types;

    You would put types in the switch parameters.


    Quote Originally Posted by Biggie Smalls View Post
    You can use only int in switch
    You can use almost any object as long as the cases fit it.
    Reply With Quote  
     

  6. Thankful user:


  7. #5  
    Registered Member
    Sirloin's Avatar
    Join Date
    Feb 2012
    Age
    27
    Posts
    782
    Thanks given
    186
    Thanks received
    175
    Rep Power
    105
    Quote Originally Posted by Wildskiller View Post
    Example: private ThingTypes types;

    You would put types in the switch parameters.
    Thanks, no errors, but I want to make sure I'm doing this part correctly.
    Code:
    	public static ThingTypes start(Player player, Item item) {
    		switch (item.getId()) {
    			case 1: //item id doesn't really matter yet.
    				player.sm("Test");
    				return ThingTypes.REGULAR;
    		}
    		getThingType(player);
    		return types;
    	}
    Reply With Quote  
     

  8. #6  
    Banned

    Join Date
    Aug 2012
    Posts
    611
    Thanks given
    88
    Thanks received
    118
    Rep Power
    0
    Quote Originally Posted by Important Man View Post
    Thanks, no errors, but I want to make sure I'm doing this part correctly.
    Code:
    	public static ThingTypes start(Player player, Item item) {
    		switch (item.getId()) {
    			case 1: //item id doesn't really matter yet.
    				player.sm("Test");
    				return ThingTypes.REGULAR;
    		}
    		getThingType(player);
    		return types;
    	}
    What are you trying to do?
    Reply With Quote  
     

  9. #7  
    Member Switch Market Banned


    Luke132's Avatar
    Join Date
    Dec 2007
    Age
    35
    Posts
    12,574
    Thanks given
    199
    Thanks received
    7,106
    Rep Power
    5000
    stop using datatypes that youve got no idea how to use

    Attached imageAttached image
    Reply With Quote  
     

  10. #8  
    Registered Member
    Sirloin's Avatar
    Join Date
    Feb 2012
    Age
    27
    Posts
    782
    Thanks given
    186
    Thanks received
    175
    Rep Power
    105
    Quote Originally Posted by Luke132 View Post
    stop using datatypes that youve got no idea how to use
    Sorry, but we've all got to learn eventually, and unfortunately I haven't, yet.
    Reply With Quote  
     

  11. #9  
    Member Switch Market Banned


    Luke132's Avatar
    Join Date
    Dec 2007
    Age
    35
    Posts
    12,574
    Thanks given
    199
    Thanks received
    7,106
    Rep Power
    5000
    first please explain what youre trying to do, why are you using an enum and why do you want to switch etc

    Attached imageAttached image
    Reply With Quote  
     

  12. #10  
    Community Veteran


    Join Date
    Dec 2008
    Posts
    4,263
    Thanks given
    405
    Thanks received
    436
    Rep Power
    1674
    Quote Originally Posted by Biggie Smalls View Post
    You can use only int in switch
    Are you stupid?
    Reply With Quote  
     

Page 1 of 2 12 LastLast

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. Replies: 1
    Last Post: 07-12-2011, 11:39 PM
  2. [525] Switch items 2 (Bank tabs, Inteface switch)
    By 'Mystic Flow in forum Snippets
    Replies: 11
    Last Post: 01-22-2011, 01:25 PM
  3. Switch
    By Cjay00091 in forum Application Development
    Replies: 7
    Last Post: 10-05-2009, 04:44 AM
  4. Adding a ::switch to Switch Magic
    By mans in forum Tutorials
    Replies: 6
    Last Post: 09-26-2008, 04:27 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
  •