Jump to content

shoppop

Member
  • Content count

    38
  • Joined

  • Last visited

About shoppop

  • Rank
    Bronze Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. [quote name='A Duck Tale']I'm guessing this is want you mean? [CODE] if (player.getSkills().getLevel(Skills.ATTACK) % 2 == 1){ [COLOR="#FF0000"]int subtractThis = (player.getSkills().getLevel(Skills.ATTACK) - 1 ) / 2;[/COLOR] ActionSender.sendInterfaceConfig(player, 647, bvalue[COLOR="#FF0000"] - subtractThis[/COLOR], true);//bvalue here is 48 ActionSender.sendInterfaceConfig(player, 647, fvalue, true);//favlue here is 608 } [/CODE][/QUOTE] i have come up with this.. is there anyway i can convert the tick to instantly load the configs? World.getWorld().submit(new Tick(0) { int current = start; [MENTION=15855]Over[/MENTION]ride public void execute() { ActionSender.sendInterfaceConfig(player, interfaceIdt, current, hidden); player.sendMessage("Current config: " + current + ", " + hidden); current++; if (current > end) { stop(); } } }); World.getWorld().submit(new Tick(0) { int current = starti; [MENTION=15855]Over[/MENTION]ride public void execute() { ActionSender.sendInterfaceConfig(player, interfaceIdti, current, hiddeni); player.sendMessage("Current config: " + current + ", " + hiddeni); current++; if (current > endi) { stop(); } } }); }}
  2. [quote name='A Duck Tale']I mean that the operation will only have a choice of returning a certain remainder. dividing [COLOR="#FF0000"]ANY[/COLOR] number by four for example, will give you four possible remainders: - no remainder (4 / 4 = 1 r 0), - remainder one (5 / 4 = 1 r 1), - remainder two (6 / 4 = 1 r 2) - and remainder three (7 / 4 = 1 r 3 ). - then remainder zero again (8 / 4 = 2 r 0) - then remainder one (9 / 4 = 2 r 1) - then remainder two (10 / 4 = 2 r 2) - and so on forever... so when you perform a modulus 4 on any number, there are only four possible outcomes. In the case of this you only are checking if the players level is even (will not have a remainder) or if the players level is odd(will have a remainder) and therefore you only need to use % 2 as the only possible remainders you want are either 0 (no remainder when divided by two) or 1 (had a remainder when divided by two) - level 1: 1 % 2 = 1 / 2 = 0 remainder 1 (execute code as remainder is 1) - level 2 : 2 % 2 = 2 / 2 = 1 remainder 0 (do nothing as remainder is 0) - level 3: 3 % 2 = 3 / 2 = 1 remainder 1 (execute code as remainder is 1) - level 4: 4 % 2 = 4 / 2 = 2 remainder 0 (do nothing as remainder is 0) - Level 5: 5 % 2 = 5 / 2 = 2 remainder 1 (execute code as remainder is 1) -etc so instead of writing: [CODE] if (player.getSkills().getLevel(Skills.ATTACK) == 1){ ActionSender.sendInterfaceConfig(player, 647, bvalue, true);//bvalue here is 48 ActionSender.sendInterfaceConfig(player, 647, fvalue, true);//favlue here is 608 } else if (player.getSkills().getLevel(Skills.ATTACK) == 3){ ActionSender.sendInterfaceConfig(player, 647, bvalue-1, true);//bvalue here is 49 ActionSender.sendInterfaceConfig(player, 647, fvalue-1, true);//609 } else if (player.getSkills().getLevel(Skills.ATTACK) == 5){ ActionSender.sendInterfaceConfig(player, 647, bvalue-2, true); ActionSender.sendInterfaceConfig(player, 647, fvalue-2, true); } else if (player.getSkills().getLevel(Skills.ATTACK) == 7){ ActionSender.sendInterfaceConfig(player, 647, bvalue-3, true); ActionSender.sendInterfaceConfig(player, 647, fvalue-3, true); } else if (player.getSkills().getLevel(Skills.ATTACK) == 9){ ActionSender.sendInterfaceConfig(player, 647, bvalue-4, true); ActionSender.sendInterfaceConfig(player, 647, fvalue-4, true); } else if (player.getSkills().getLevel(Skills.ATTACK) == 11){ ActionSender.sendInterfaceConfig(player, 647, bvalue-5, true); ActionSender.sendInterfaceConfig(player, 647, fvalue-5, true); } // All the way to 99 [/CODE] you only need to check if there is a remainder: [CODE] if (player.getSkills().getLevel(Skills.ATTACK) [COLOR="#FF0000"]% 2[/COLOR] == 1){ // Checks if the players level is odd ActionSender.sendInterfaceConfig(player, 647, bvalue, true);//bvalue is incremented by 1 ActionSender.sendInterfaceConfig(player, 647, fvalue, true);//favlue is incremented by 1 } [/CODE] If your still not 100% sure on how modulus works, consider having a look at the tutorial below: [url]http://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html[/url][/QUOTE] i understand completely what your saying and it is very useful, im wondering if you can make it so.. when the level is 1 then the config is bvalue when the level is 3 then the bvalue goes down by one. for example. if (player.getSkills().getLevel(Skills.ATTACK) == 1){ ActionSender.sendInterfaceConfig(player, 647, bvalue, true);//bvalue here is 48 ActionSender.sendInterfaceConfig(player, 647, fvalue, true);//favlue here is 608 } else if (player.getSkills().getLevel(Skills.ATTACK) == 3){ ActionSender.sendInterfaceConfig(player, 647, bvalue-1, true);//bvalue here is 49 ActionSender.sendInterfaceConfig(player, 647, fvalue-1, true);//609 } so overall, every time the odd number goes up by 1 then the bvalue decreases by 1 can this be done without writing all the code all the way up to 99? maybe something like this for example? if (player.getSkills().getLevel(Skills.DUNGEONEERING) == +1){ // this is nothing like what im trying to say but its the only example i can give bvalue = bvalue -1; } basicly i need to load the configs on the dungeoneering floor interface according to the maximum floor that they can access for their dungeoneering level (like it should)
  3. [quote name='A Duck Tale']I'm assuming the method you highlighted increases the variable in question by 1. if you want the variable to go down by one, just minus two. [CODE] ActionSender.sendInterfaceConfig(player, 947, floorvalue - 2, true); [/CODE] that way when it increases by one you will have only one less than its original. Would apply a modulus operation check here as well man. if (player.getSkills().getLevel(Skills.DUNGEONEERING)[COLOR="#FF0000"] % 2[/COLOR] == 1){ //Do whatever in here for all odd numbers } A side note if you were wondering: [CODE] Modulus takes the remainder of a number divided. for the example above, lets say the player is level 85: 85 % 2 is the same as 85 / 2 = 42 remainder 1 modulus returns the remainder which in this case is 1. therefore 85 % 2 = 1 50 % 2 (even numbers) would return a remainder of 0 ( 50 % 2 = 0) if it was % 3 you could have return types 0,1,2. % 4 would be 0,1,2,3 return types: 85 % 4 = 85 / 4 = 21 remainder 1 therefore 85 % 4 = 1 Hope this clears up modulus if you weren't sure on how it worked :). [/CODE][/QUOTE] quick question i get everthing but this line "if it was % 3 you could have return types 0,1,2. % 4 would be 0,1,2,3 return types:" what do you mean by return types? EDIT:Just to clarify can i use the modulus to make this.. int fvalue = player.getSkills().getLevel(Skills.ATTACK) + 607; int bvalue = player.getSkills().getLevel(Skills.ATTACK) + 47; if (buttonId == 766) { if (player.getSkills().getLevel(Skills.ATTACK) == 1){ ActionSender.sendInterfaceConfig(player, 647, bvalue, true);//bvalue here is 48 ActionSender.sendInterfaceConfig(player, 647, fvalue, true);//favlue here is 608 } else if (player.getSkills().getLevel(Skills.ATTACK) == 3){ ActionSender.sendInterfaceConfig(player, 647, bvalue-1, true);//bvalue here is 49 ActionSender.sendInterfaceConfig(player, 647, fvalue-1, true);//609 } else if (player.getSkills().getLevel(Skills.ATTACK) == 5){ ActionSender.sendInterfaceConfig(player, 647, bvalue-2, true); ActionSender.sendInterfaceConfig(player, 647, fvalue-2, true); } else if (player.getSkills().getLevel(Skills.ATTACK) == 7){ ActionSender.sendInterfaceConfig(player, 647, bvalue-3, true); ActionSender.sendInterfaceConfig(player, 647, fvalue-3, true); } else if (player.getSkills().getLevel(Skills.ATTACK) == 9){ ActionSender.sendInterfaceConfig(player, 647, bvalue-4, true); ActionSender.sendInterfaceConfig(player, 647, fvalue-4, true); } else if (player.getSkills().getLevel(Skills.ATTACK) == 11){ ActionSender.sendInterfaceConfig(player, 647, bvalue-5, true); ActionSender.sendInterfaceConfig(player, 647, fvalue-5, true); } else if (player.getSkills().getLevel(Skills.ATTACK) == 13){ ActionSender.sendInterfaceConfig(player, 647, bvalue-6, true); ActionSender.sendInterfaceConfig(player, 647, fvalue-6, true); into a couple of lines, to reduce the amount of coding? i have to otherwise its going to get very messy lol
  4. wow thanks, explained really well. this will come in handy! :)
  5. [quote name='A Duck Tale']you could just implement a modulus operation. [CODE] if ( player.getSkills().getLevel(Skills.ATTACK) [COLOR="#FF0000"]% 2[/COLOR] == 1){ [/CODE] So the code would be: [CODE] case 947://interface int fvalue = player.getSkills().getLevel(Skills.ATTACK) + 607; int bvalue = player.getSkills().getLevel(Skills.ATTACK) + 47; if (buttonId == 766) { if (player.getSkills().getLevel(Skills.ATTACK) % 2 == 1){ ActionSender.sendInterfaceConfig(player, 647, bvalue, true);//bvalue++ ActionSender.sendInterfaceConfig(player, 647, fvalue, true);//favlue++ } //Any other code that you didn't put in your snippet } //Any other code that you didn't put in your snippet break; [/CODE][/QUOTE] thanks for that, i did do it a different way but still works :) Another question: Is there a way i can make [COLOR="#FF0000"]this[/COLOR] code run multiple times but going down by 1 each time? int f1 = player.getSkills().getLevel(Skills.DUNGEONEERING); int floorvalue = 48 + f1 - 1 + 48 / 2; int f = 48 + f1 - 1 + 48 / 2 - 47; int imgvalue = 608 + f1 - 1 + 608 / 2; int get = player.getPlayerDefinition().getFloor(); player.getPlayerDefinition().setFloor(f); [COLOR="#FF0000"]ActionSender.sendInterfaceConfig(player, 947, floorvalue, true);[/COLOR] ActionSender.sendInterfaceConfig(player, 947, imgvalue, true); instead of writing for every level| if player.getSkills().getLevel(Skills.DUNGEONEERING) == 1){ ActionSender.sendInterfaceConfig(player, 947, 608, true); } if player.getSkills().getLevel(Skills.DUNGEONEERING) == 3){ ActionSender.sendInterfaceConfig(player, 947, 609, true); } ect ect ect
  6. is there a better system i can make so when the attack skills goes up by 2(odd number sequence) then the bvalue & fvalue(configs) goes up by 1? [CODE] case 947://interface int fvalue = player.getSkills().getLevel(Skills.ATTACK) + 607; int bvalue = player.getSkills().getLevel(Skills.ATTACK) + 47; if (buttonId == 766) { if (player.getSkills().getLevel(Skills.ATTACK) == 1){ ActionSender.sendInterfaceConfig(player, 647, bvalue, true);//bvalue here is 48 ActionSender.sendInterfaceConfig(player, 647, fvalue, true);//favlue here is 608 } else if (player.getSkills().getLevel(Skills.ATTACK) == 3){ ActionSender.sendInterfaceConfig(player, 647, bvalue-1, true);//bvalue here is 49 ActionSender.sendInterfaceConfig(player, 647, fvalue-1, true);//609 } else if (player.getSkills().getLevel(Skills.ATTACK) == 5){ ActionSender.sendInterfaceConfig(player, 647, bvalue-2, true); ActionSender.sendInterfaceConfig(player, 647, fvalue-2, true); } else if (player.getSkills().getLevel(Skills.ATTACK) == 7){ ActionSender.sendInterfaceConfig(player, 647, bvalue-3, true); ActionSender.sendInterfaceConfig(player, 647, fvalue-3, true); } else if (player.getSkills().getLevel(Skills.ATTACK) == 9){ ActionSender.sendInterfaceConfig(player, 647, bvalue-4, true); ActionSender.sendInterfaceConfig(player, 647, fvalue-4, true); } else if (player.getSkills().getLevel(Skills.ATTACK) == 11){ ActionSender.sendInterfaceConfig(player, 647, bvalue-5, true); ActionSender.sendInterfaceConfig(player, 647, fvalue-5, true); } else if (player.getSkills().getLevel(Skills.ATTACK) == 13){ ActionSender.sendInterfaceConfig(player, 647, bvalue-6, true); ActionSender.sendInterfaceConfig(player, 647, fvalue-6, true); }[/CODE]
  7. [quote name='A Duck Tale']Implement it how you would any other command for your server, making sure this is inside the '[COLOR="#FF0000"]playerCommands[/COLOR]' method. If your commands are all just bunched together with '[COLOR="#FF0000"]playerRights[/COLOR]' distinguishing between who accesses what, you would only just need to add this. An example: [CODE] if (playerCommand.equals("vote")){ try{ URI myVotePage = new URI("http://www.google.com.au"); Desktop.getDesktop().browse(myVotePage); } catch(Exception e){ System.out.println("Error: Player " + c.playerName + " could not open the specified webpage..."); } } [/CODE] Again, I'm not sure about how your Commands.java is structured, and have no intention of checking, but presumably assuming you know what is what in java (methods, variables, etc.), then the above should be enough. Also, you only need to add it to the server as the client sends the command packet to the server for evaluation before sending a packet back(AKA Server handles all commands issued). If your client is handling any commands, then id consider making it so only the server does, as that presents a serious security flaw in your client(not for this, specifically, but in general).[/QUOTE] why is it that when i use this command if (command[0].equals("vote")){ try{ URI myVotePage = new URI("http://www.google.com.au"); Desktop.getDesktop().browse(myVotePage); } catch(Exception e){ System.out.println("Error: Player " + username + " could not open the specified webpage..."); } } why does the website open on my vps?
  8. [quote name='falconpunch']I believe that boolean is if you have the quick prayers activated, not if you have the interface open. So you need to look through and find the quick prayer setting method like buttons, add a boolean and make it true when they're on the interface and false when they're not. I believe this might work.[/QUOTE] Alright thanks bud will give it a go :)
  9. when you have the interface which allows you to select quick prayers and then change from normal prayers to curses and and select curses quick prayers aswell then hit confirm it uses the prayers you selected on normal prayers and the ones you selected on curses aswell. i use the altar for a method the players can use to switch prayers; so far i have come up with this. [CODE] } else if (objectClicked == 47120) { if (this.usingQuickPrayer) player.sendMessage("Please close your quick prayers."); return; } else { if (player.getPrayer().isAncientCurses() == true) { DialogueManager.sendOptionDialogue(player, new int[]{874, -1}, "Switch to normal prayers.", "Keep using curses."); } } if(player.getPrayer() .isAncientCurses() == false) { DialogueManager.sendOptionDialogue(player, new int[]{875, -1}, "Switch to curses.", "Keep using prayers."); }[/CODE] doesnt seem to work though. any suggestions?
  10. [quote name='falconpunch']I believe your code is checking if the person clicking on someone else is a donator if they are a donator and their rights are zero, then it will show respected donator and their name.[/QUOTE] see i originally thought that my self but when the first line is (player.getUsername().equals("bob")) then it works fine and everyone can see that bob is a respected donor ?
  11. I added this in playerupdate.java it seems to work but only donators can see it. [CODE] else if (player.getDefinition().getDonator() == 1 && player.getRights() == 0) { appearanceData.writeRS2String("<img=2><b><col=993399>Respected Donator</col></b> "+Misc.formatPlayerNameForDisplay(p.getUsername())); }[/CODE] any suggestions? EDIT: or does anyone know where i could find a cache editor for a 637?
  12. [quote name='Vesta Main']Try: public static boolean diagonal(Location l, int xDial, int yDial) { int xDial = Math.abs(l.getX() - x); int yDial = Math.abs(l.getY() - y); return xDial == 1 && yDial == 1; } (replace with the solution Zayuh gave if I'm wrong)[/QUOTE] that doesn't work mate :P
  13. [quote name='Zayuh']correct file, wrong part. look for ; [COLOR="#0000FF"]public static boolean diagonal(Location l, Location l1) { int xDial = Math.abs(l.getX() - l1.getX()); int yDial = Math.abs(l.getY() - l1.getY()); return xDial == 1 && yDial == 1; }[/COLOR] replace it with; [COLOR="#0000FF"]public static boolean diagonal(Location l, int x, int y) { int xDial = Math.abs(l.getX() - x); int yDial = Math.abs(l.getY() - y); return xDial == 1 && yDial == 1; }[/COLOR][/QUOTE] i get this src\org\dementhium\model\combat\CombatMovement.java:38: error: method diagonal i n class CombatMovement cannot be applied to given types; if (diagonal(mob.getLocation(), other.getLocation())) { ^ required: Location,int,int found: Location,Location reason: actual and formal argument lists differ in length 1 error Press any key to continue . . .
  14. i did fix this before. but was a long while ago. i do remember it was something to do with these in combatmovement.java. [CODE] int maximumDistance = type.getDistance(); if ((type == CombatType.MELEE || type == CombatType.DEFAULT) && canMelee(mob, other)) { if (diagonal(mob.getLocation(), other.getLocation())) { mob.requestClippedWalk(other.getLocation().getX(), mob.getLocation().getY()); return true; } if (mob.size() > 1 || other.size() > 1 || checkWall(mob, other)) { return true; } } else { if (type == CombatType.RANGE && mob.isPlayer() && mob.getPlayer().getSettings().getCombatStyle() == WeaponInterface.STYLE_LONG_RANGE) { maximumDistance += 2; } if (distance > 0 && distance <= maximumDistance) { mob.getWalkingQueue().reset(); return canSendProjectile(mob, other); } } if (mob.isPlayer()) { if (other.getWalkingQueue().getLastLocation() != null) { Location victimLocation = getNearest(mob, other)[1]; int followX = victimLocation.getX(); int followY = victimLocation.getY(); World.getWorld().doPath(new DefaultPathFinder(), mob, followX, followY); }[/CODE] can anyone jog my memory? im abit rusty :P
  15. how do i create a BeastOfBurden setter and getter. need to know how to create a setBob and getBob method in player.java if possible
×