Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure : [link]
      Today at 12:52:54 PM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure : [link]
      Today at 12:52:50 PM
    • U Go Home: hey does anyone have allstarscape v2 i want to make it better something to do and try and bring back the good old days
      Today at 09:22:14 AM
    • ArtexAdv:[link] come check out the most
      November 18, 2019, 11:39:14 AM
    • ArtexAdv: Www.galaxy-rsps.net come check out the most unique custom rsps
      November 18, 2019, 11:38:50 AM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure : [link]
      November 17, 2019, 10:14:59 PM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure : [link]
      November 17, 2019, 10:14:50 PM
    • Mazeingmaze: last logged in 2008
      November 17, 2019, 06:46:52 PM
    • Mazeingmaze: Ayy BRO
      November 17, 2019, 06:46:46 PM
    • SuperNativeZ: WANT TO BE APART OF THE BEST RSPS? [link]
      November 17, 2019, 12:22:53 AM
    • SuperNativeZ: WHY CHOOSE GALAXY RSPS?  WE HAVE THE BEST UNIQUE GAMEPLAY [link]
      November 17, 2019, 12:22:42 AM
    • SuperNativeZ: WHY CHOOSE GALAXY RSPS?  WE HAVE THE BEST UNIQUE GAMEPLAY [link]
      November 17, 2019, 12:22:39 AM
    • ragnoroker: Brand new server, come join the fun - unique server - RuneGuild -[link]
      November 15, 2019, 12:46:05 PM
    • ragnoroker: Brand new server, come join the fun - unique server - RuneGuild -[link]
      November 15, 2019, 12:46:01 PM
    • Cole1497: join horney scape we are horney all the time and have a sex emote
      November 09, 2019, 05:14:33 PM
    • thewraith500: try autoscape,0rg brand new osrs CUSTOMS server! fight caves for flaming fire cape, upgrade them to infernal wings + more!
      November 09, 2019, 01:37:29 AM
    • SuperNativeZ: Come play brand new server [link]
      November 08, 2019, 02:13:24 PM
    • SuperNativeZ: Come play brand new server [link]
      November 08, 2019, 02:13:17 PM
    • SuperNativeZ: Come play brand new server [link]
      November 08, 2019, 02:13:14 PM
    • ragnoroker: Brand new server, come join the fun - unique server - RuneGuild - [link]
      November 07, 2019, 11:55:44 AM

    Author Topic: [317refactor] Adding the shift-click focus to your client  (Read 638 times)

    0 Members and 1 Guest are viewing this topic.

    OfflineAmbokile

    • Member
    • ****
    • Posts: 3,009
    • Thanks: +0/-0
      • View Profile
    [317refactor] Adding the shift-click focus to your client
    « on: January 31, 2015, 07:00:15 AM »
    Hi all. A short guide here on adding the shift-click focusing to your 317refactor-based client.

    Head over to the RSApplet class. You want to declare a new boolean called shiftClick with the other global variables.
    Code: Java
    1. boolean shiftClick;

    You now want to head to the mousePressed method and add the following code above the isMetaDown() check.
    Code: Java
    1. if(mouseEvent.isShiftDown()){
    2.         shiftClick =true;
    3. }else{
    4.         shiftClick =false;
    5. }

    This uses the isShiftDown() method from the MouseEvent class to check whether the user is holding shift whilst clicking the mouse and, if so, stores that in the boolean.

    We're done in the RSApplet class, head over to the Client class. At the top of the class, declare a boolean called shiftClickWarning with a default value of false.
    Code: Java
    1. boolean shiftClickWarning =false;

    Search for the following line of code, there is only one occurrence in the class.
    Code: Java
    1. if(WorldController.clickedTileX!=-1){

    Now, replace everything inside that if-statement with the following code:
    Code: Java
    1. if(super.shiftClick){
    2.         if(!shiftClickWarning){
    3.                 pushMessage("Walking disabled due to shift-click.", 0, "");
    4.                 shiftClickWarning =true;
    5.         }
    6. }else{
    7.         int x = WorldController.clickedTileX;
    8.         int y = WorldController.clickedTileY;
    9.         boolean walkable = doWalkTo(0, 0, 0, 0, localPlayer.waypointY[0],
    10.                         0, 0, y, localPlayer.waypointX[0], true, x);
    11.         WorldController.clickedTileX=-1;
    12.         if(walkable){
    13.                 crossX =super.clickX;
    14.                 crossY =super.clickY;
    15.                 crossType =1;
    16.                 crossIndex =0;
    17.         }
    18. }

    As you can see, the code checks whether the player is holding shift. If they're not, click on the tile as usual. If they are, the code then checks whether they've already received the warning message. If they haven't, the code sends the message and records the fact that they've received the message.
    Runescape Gambling

     

    Copyright © 2017 MoparScape. All rights reserved.
    Powered by SMFPacks SEO Pro Mod |
    SimplePortal 2.3.5 © 2008-2012, SimplePortal