Thread: Help Please

Results 1 to 9 of 9
  1. #1 Help Please 
    I'm President Carter


    Join Date
    Jan 2011
    Posts
    1,204
    Thanks given
    17
    Thanks received
    222
    Rep Power
    144
    Well I am working on dung system now and I'm trying to clean things up a bit. For my rooms I wanted to use an array like this:
    Code:
    public static final int[][] ROOM_IDS = { {1, 3291, 9177}, {2, 3291, 9179} }; //room id, xcord, ycord
    But I was wondering how I would return each value so it read it as I want it to be read. Like the Room Id, X Cord and Y Cord. So the final code would be like:
    Code:
    if (c.dungLevel <= 0 && c.getItems().playerHasItem(20880, 1) && return the value here for the room id, xcord, ycord) {
    					c.getPA().movePlayer(3291, 9179, 0);
    					c.dungLevel = 1;
    				} else if (c.dungLevel >= 1 && return the value here for the room id, xcord, ycord) {
    					c.getPA().movePlayer(3291, 9177, 0);
    				} else {
    					c.sendMessage("You need a key to get through here.");
    				}
    Also the X & Y cord is where the player is standing. So it would have to return it as like:
    Code:
    c.absX == # && c.absY == ##


    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Feb 2007
    Posts
    994
    Thanks given
    25
    Thanks received
    47
    Rep Power
    604
    Code:
    c.roomId = ROOM_IDS[floorId][0]
    c.absX = ROOM_IDS[floorId][1]
    c.absY = ROOM_IDS[floorId][2]
    So for room one floorId would equal 0 and so on. Is this what you wanted?
    Reply With Quote  
     

  3. #3  
    I'm President Carter


    Join Date
    Jan 2011
    Posts
    1,204
    Thanks given
    17
    Thanks received
    222
    Rep Power
    144
    No that's not what I wanted. What I want it to do is something like this:
    Code:
    public static int roomId() {
    		return (the first number);
    	}
    Code:
    public static int getXCord() {
    		return (the second number);
    	}
    As so on but in the code I would be like:
    Code:
    if (c.dungLevel <= 0 && c.getItems().playerHasItem(20880, 1) && (roomId == 1, xCord == ##, yCord == ##)) {
    					c.getPA().movePlayer(3291, 9179, 0);
    					c.dungLevel = 1;
    				} else if (c.dungLevel >= 1 && (roomId == 2, xCord == ##, yCord == ##)) {
    					c.getPA().movePlayer(3291, 9177, 0);
    				} else {
    					c.sendMessage("You need a key to get through here.");
    				}


    Reply With Quote  
     

  4. #4  
    Registered Member

    Join Date
    Feb 2007
    Posts
    994
    Thanks given
    25
    Thanks received
    47
    Rep Power
    604
    Code:
    public static int roomId(int floorId) {
    	return ROOM_IDS[floorId][0];
    }
    You get the idea? add your own size check if you want to prevent errors.
    Reply With Quote  
     

  5. #5  
    Registered Member

    Join Date
    Mar 2010
    Age
    26
    Posts
    686
    Thanks given
    35
    Thanks received
    92
    Rep Power
    157
    l2enumbro
    Reply With Quote  
     

  6. #6  
    Registered Member

    Join Date
    Feb 2007
    Posts
    994
    Thanks given
    25
    Thanks received
    47
    Rep Power
    604
    Quote Originally Posted by `Vain View Post
    l2enumbro
    He using a valid method to achieve what he requires so I don't see how that would benefit for this task.
    Reply With Quote  
     

  7. #7  
    Registered Member

    Join Date
    Mar 2010
    Age
    26
    Posts
    686
    Thanks given
    35
    Thanks received
    92
    Rep Power
    157
    Quote Originally Posted by bluurr View Post
    He using a valid method to achieve what he requires so I don't see how that would benefit for this task.
    enums are more efficient, yo'
    Reply With Quote  
     

  8. #8  
    #Winning

    Join Date
    Apr 2011
    Age
    25
    Posts
    2,247
    Thanks given
    367
    Thanks received
    387
    Rep Power
    1187
    c.absX ==
    c.absY ==

    and make an int for roomID
    if (c.dungLevel <= 0 && c.getItems().playerHasItem(20880, 1) && c.absX == ## && c.absY == ## && RoomID == ##) {


    Vouches
    Spoiler for Vouches:

    Quote Originally Posted by Exile rsps View Post
    Vouch thanks for that pic
    Quote Originally Posted by bwuk _im_pb View Post
    i vouch for charlie hes legit
    Quote Originally Posted by Pastaway
    Vouch for 'Charlie. Added a tut to my server I couldn't add and payed him after =]
    Quote Originally Posted by mongolias
    Vouch for 'Charlie. Sold me a banner, the trade went quick and efficiently.
    Quote Originally Posted by Lane
    Vouch for charlie, he is #1
    Quote Originally Posted by Raw Envy View Post
    Vouch for Charlie.
    Quote Originally Posted by -Null Code-
    Vouch Legit bought rs membership
    Quote Originally Posted by tucybro
    Traded with Charlie, went smoothly I went first and he paid promptly without and issues, great trader!



    Reply With Quote  
     

  9. #9  
    Registered Member

    Join Date
    Feb 2007
    Posts
    994
    Thanks given
    25
    Thanks received
    47
    Rep Power
    604
    Quote Originally Posted by `Vain View Post
    enums are more efficient, yo'
    Can you back up that statement? Why would they be more efficient for this simple task?
    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
  •