Thread: Stupid Sara Pillar in GWD

Results 1 to 7 of 7
  1. #1 Stupid Sara Pillar in GWD 
    Registered Member xRokku_Ri's Avatar
    Join Date
    Jun 2014
    Posts
    305
    Thanks given
    91
    Thanks received
    30
    Rep Power
    0
    Spoiler for spoiler:
    edit---- I fixed it.

    change the if statement to check for range level and send message, and the else to teleport. and it works fine now.





    Code:
    if (object.getId() == 26303 && player.getX() == 2871 && player.getY() == 5279) {
    					if (player.getSkills().getLevel(Skills.RANGE) >= 70)
    					player.useStairs(9095, new WorldTile(2871, 5269, 2), 2, 1);
    					
    				} else { 
    					player.getPackets().sendGameMessage("You need 70 ranged to access this area.");
    				}
    				
    				if (object.getId() == 26303 && player.getX() == 2871 && player.getY() == 5269) {
    					player.useStairs(9095, new WorldTile(2871, 5279, 2), 2, 1);
    				
    				}
    This is the code for the saradomin pillar.

    It seems fine to me, but it's not. What's happening is that if the player doesn't have 70 ranged, clicking the pillar from the outside does nothing. If the player is INSIDE and is clicking the pillar from there without 70 range, it sends the ranged message. I obviously have the code stating that if the player is at the coords outside then it should display the message. If they are on the inside, they obviously have 70 range so It's supposed to just let them leave.


    Ok I fixed this problem, now it created another one.


    Code:
    if (object.getId() == 26303 && player.getX() == 2871
    						&& player.getY() == 5279) {
    					if (player.getSkills().getLevel(Skills.RANGE) < 70)
    						;
    					player.getPackets().sendGameMessage(
    							"You need 70 ranged to access this area.");
    
    				} else {
    					player.useStairs(9095, new WorldTile(2871, 5269, 2), 2, 1);
    				}
    This code works flawlessly.. for the pillar. Now if i click any other object in the game I get teleported to the inside of the sara pillar.


    "If you believe in your dreams, I will prove to you that you can achieve your dreams just by working hard." ~Rock Lee
    Reply With Quote  
     

  2. #2  
    Registered Member xRokku_Ri's Avatar
    Join Date
    Jun 2014
    Posts
    305
    Thanks given
    91
    Thanks received
    30
    Rep Power
    0
    Fixed that problem, and it created another one.


    "If you believe in your dreams, I will prove to you that you can achieve your dreams just by working hard." ~Rock Lee
    Reply With Quote  
     

  3. #3  
    Registered Member Sjonsen's Avatar
    Join Date
    May 2012
    Posts
    321
    Thanks given
    15
    Thanks received
    44
    Rep Power
    20
    Code:
    if (object.getId() == 26303 && player.getX() == 2871
    						&& player.getY() == 5279) {
    					if (player.getSkills().getLevel(Skills.RANGE) < 70){
    					player.getPackets().sendGameMessage(
    							"You need 70 ranged to access this area.");
    
    				} else {
    					player.useStairs(9095, new WorldTile(2871, 5269, 2), 2, 1);
                                      }
    			}

    You had this:

    Code:
    if (player.getSkills().getLevel(Skills.RANGE) < 70);
    A ; means the end of a line. By using { } that means, if conditions in the if statement are met, execute what's between { }.
    Reply With Quote  
     

  4. #4  
    Registered Member xRokku_Ri's Avatar
    Join Date
    Jun 2014
    Posts
    305
    Thanks given
    91
    Thanks received
    30
    Rep Power
    0
    Quote Originally Posted by Sjonsen View Post
    Code:
    if (object.getId() == 26303 && player.getX() == 2871
    						&& player.getY() == 5279) {
    					if (player.getSkills().getLevel(Skills.RANGE) < 70){
    					player.getPackets().sendGameMessage(
    							"You need 70 ranged to access this area.");
    
    				} else {
    					player.useStairs(9095, new WorldTile(2871, 5269, 2), 2, 1);
                                      }
    			}

    You had this:

    Code:
    if (player.getSkills().getLevel(Skills.RANGE) < 70);
    A ; means the end of a line. By using { } that means, if conditions in the if statement are met, execute what's between { }.
    I see. Thank you very much. I misunderstood the difference between brackets and semi-colons.


    "If you believe in your dreams, I will prove to you that you can achieve your dreams just by working hard." ~Rock Lee
    Reply With Quote  
     

  5. #5  
    Registered Member Sjonsen's Avatar
    Join Date
    May 2012
    Posts
    321
    Thanks given
    15
    Thanks received
    44
    Rep Power
    20
    Quote Originally Posted by xRokku_Ri View Post
    I see. Thank you very much. I misunderstood the difference between brackets and semi-colons.
    No problem, hope you understand it now!
    Reply With Quote  
     

  6. Thankful user:


  7. #6  
    Super Donator

    Janizary's Avatar
    Join Date
    Jul 2009
    Age
    22
    Posts
    2,131
    Thanks given
    109
    Thanks received
    137
    Rep Power
    1031
    I think that's armadyl.


    Quote Originally Posted by Pirlo View Post
    I don't think the cold war existed during/before WWI
    Reply With Quote  
     

  8. #7  
    Registered Member xRokku_Ri's Avatar
    Join Date
    Jun 2014
    Posts
    305
    Thanks given
    91
    Thanks received
    30
    Rep Power
    0
    Quote Originally Posted by Flammable View Post
    I think that's armadyl.
    Right, sorry. :3


    "If you believe in your dreams, I will prove to you that you can achieve your dreams just by working hard." ~Rock Lee
    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. Replies: 1
    Last Post: 11-26-2012, 02:24 AM
  2. sara room in gwd floor glitch
    By youer3455 in forum Help
    Replies: 6
    Last Post: 07-11-2011, 07:33 AM
  3. [Pi] Can't Atk npc's in Gwd
    By Zerk3r in forum Help
    Replies: 4
    Last Post: 03-15-2011, 11:29 PM
  4. Stupid php errors in custom templates
    By Patawic in forum Application Development
    Replies: 2
    Last Post: 03-27-2010, 07:48 AM
  5. Replies: 5
    Last Post: 10-30-2008, 11:22 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
  •