Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • ragnoroker: Brand new server! Less than 1 week old! Nightmare/Raids 1/2/Hydra/Pk Modes/Exp modes/ Unique  Join today - [link]
      July 04, 2020, 06:42:38 PM
    • ragnoroker: Brand new server! Less than 1 week old! Nightmare/Raids 1/2/Hydra/Pk Modes/Exp modes/ Unique  Join today - [link]
      July 04, 2020, 06:42:32 PM
    • iddsyou: PkOwnage 2 worlds, modern OSRS & 2014 server! [link]  Join us on Discord! [link]
      July 04, 2020, 11:07:29 AM
    • slayerpure: kingdom full blown custom server with over 50 custom bosses released last week. play now here     [link]
      July 02, 2020, 08:44:32 PM
    • jgoet: dodian !!
      July 02, 2020, 07:15:44 PM
    • jgoet: join [link]  its back online !!!!
      July 02, 2020, 07:15:37 PM
    • Protojae: RIP moparscape
      July 02, 2020, 03:01:32 PM
    • Protojae: obviously thiswebsite is dead as fudge
      July 02, 2020, 03:01:14 PM
    • ragnoroker: RuneGuild has just been released! 1 Hour old, Come join the fun - [link]
      June 26, 2020, 02:14:21 PM
    • ragnoroker: RuneGuild has just been released! 1 Hour old, Come join the fun - [link]
      June 26, 2020, 02:14:08 PM
    • ragnoroker: RuneGuild has just been released! 1 Hour old, Come join the fun - [link]
      June 26, 2020, 02:14:00 PM
    • Fox2007: rune-nexus.com - FREE advertising, SEO optimized - no registration required
      June 26, 2020, 06:21:47 AM
    • Decimate Returns: trailer video posted for Project Decimate, Official Launch is in a few weeks! watch here: [youtube]LBorsdI-k1Y[/youtube]
      June 24, 2020, 07:18:03 PM
    • slayerpure: 1 week old rsps we need players and potential staff, customs and goku/vegeta sets play here!    [link] join our discord [link]
      June 24, 2020, 05:23:46 PM
    • Decimate Returns: Project Decimate is still in BETA: join our discord to keep up with the new content added: [link]
      June 24, 2020, 01:09:23 PM
    • Decimate Returns: Project Decimate is still in BETA: join our discord to keep up with the new content added: [link]
      June 24, 2020, 01:09:03 PM
    • dan v jad: PkOwnage OSRS Great server great community!  Join us on Discord! [link]  Download: [link]
      June 21, 2020, 09:23:28 AM
    • Lens: Sick Custom RSPS - CrystalPS. Join us on Discord. [link]
      June 20, 2020, 04:35:44 PM
    • Shady Aftermath: check out skyfire317.com gott 3 custom skills, afk zones
      June 19, 2020, 10:22:22 PM
    • Shady Aftermath: check out skyfire317.com gott 3 custom skills, afk zones
      June 19, 2020, 10:22:14 PM

    Author Topic: [317refactor] Adding the shift-click focus to your client  (Read 702 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