Jump to content
  • 0

Question

Hey, I get this error whilst trying to fix dicing. Does anyone know how to fix it? Thanks

[CODE]starting compiler process...
src\com\rs\net\decoders\handlers\InventoryOptionsHandler.java:116: error: cannot
find symbol
Dicing.handleItem(player, Rolls.PRIVATE_ROLL);
^
symbol: variable Rolls
location: class InventoryOptionsHandler
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Correctly Compiled
Press any key to continue . . .[/CODE] Edited by xCHRiS

Share this post


Link to post
Share on other sites

14 answers to this question

Recommended Posts

  • 0
Added that in. I get this error now:

Here is my code:

[code]if (itemId == 15098) {
private int Rolls;
Dicing.handleItem(player, Rolls.PRIVATE_ROLL);
player.setNextAnimation(new Animation(11900));
player.setNextGraphics(new Graphics(2075));
return;
}[/code]

Here is error:

[code]starting compiler process...
src\com\rs\net\decoders\handlers\InventoryOptionsHandler.java:124: error: illega
l start of expression
private int Rolls;
^
1 error
Correctly Compiled
Press any key to continue . . .[/code] Edited by xCHRiS

Share this post


Link to post
Share on other sites
  • 0
Maybe you forgot to import Rolls class?

Share this post


Link to post
Share on other sites
  • 0
There is no Rolls class. It is just Dicing.Java which I have made an import. Still no luck.

Share this post


Link to post
Share on other sites
  • 0
[quote name='llegitimate']private int Rolls;[/QUOTE]

[IMG]http://www.atheistfoundation.org.au/forums/images/smilies/facepalm.gif[/IMG]

[quote name='xCHRiS']Added that in. I get this error now:

Here is my code:

[code]if (itemId == 15098) {
private int Rolls;
Dicing.handleItem(player, Rolls.PRIVATE_ROLL);
player.setNextAnimation(new Animation(11900));
player.setNextGraphics(new Graphics(2075));
return;
}[/code]

Here is error:

[code]starting compiler process...
src\com\rs\net\decoders\handlers\InventoryOptionsHandler.java:124: error: illega
l start of expression
private int Rolls;
^
1 error
Correctly Compiled
Press any key to continue . . .[/code][/QUOTE]

[IMG]http://www.atheistfoundation.org.au/forums/images/smilies/facepalm.gif[/IMG]

OT:
Import Rolls enum

Share this post


Link to post
Share on other sites
  • 0
Oh right... Thanks guys

Getting same error:

My Imports:
[code]import com.rs.game.player.content.Dicing;
import com.rs.game.player.content.Dicing.Rolls;
import com.rs.game.minigames.DiceGame;[/code]

My Code:
[code]} else if (itemId == 15098) {
Dicing.handleItem(player, Rolls.FRIENDS_ROLL);
player.setNextAnimation(new Animation(11900));
player.setNextGraphics(new Graphics(2075));
return;[/code]

Dicing.Java:
[code]package com.rs.game.player.content;

import java.util.Random;

import com.rs.game.Animation;
import com.rs.game.Graphics;
import com.rs.game.player.Player;
import com.rs.game.tasks.WorldTask;
import com.rs.game.tasks.WorldTasksManager;
import com.rs.net.decoders.handlers.InventoryOptionsHandler;
import com.rs.game.minigames.DiceGame;

public class Dicing {

public static void handleRoll(final Player player, final int itemId,
int graphic, final int lowest, final int highest) {
player.getPackets().sendGameMessage("Rolling...", true);
player.getInventory().deleteItem(itemId, 1);
player.setNextAnimation(new Animation(11900));
player.setNextGraphics(new Graphics(graphic));
WorldTasksManager.schedule(new WorldTask() {
@Override
public void run() {
player.getInventory().addItem(itemId, 1);
player.getPackets().sendGameMessage(
"Clan Chat channel-mate <col=db3535>"
+ player.getDisplayName()
+ "</col> rolled <col=db3535>"
+ getRandom(lowest, highest) + "</col> on "
+ diceText(itemId) + " die.", true);
}
}, 1);
}

public static int getRandom(int lowest, int highest) {
Random r = new Random();
if (lowest > highest) {
return -1;
}
long range = (long) highest - (long) lowest + 1;
long fraction = (long) (range * r.nextDouble());
int numberRolled = (int) (fraction + lowest);
return numberRolled;
}

public static String diceText(int id) {
switch (id) {
case 15086:
return "a six-sided";
case 15088:
return "two six-sided";
case 15090:
return "an eight-sided";
case 15092:
return "a ten-sided";
case 15094:
return "a twelve-sided";
case 15096:
return "a a twenty-sided";
case 15098:
return "the percentile";
case 15100:
return "a four-sided";
}
return "";
}

}
[/code]

DiceGame.Java: (I added this from a tutorial. I dont think its needed with the Dicing class)
[code]package com.rs.game.minigames;

import com.rs.game.player.Player;
import com.rs.game.World;
import com.rs.game.ForceTalk;
import java.util.Random;

public class DiceGame {

public static void rollDice1(Player player) {
if (!player.getInventory().containsOneItem(15100)){
return;
}
int LOWEST = 1;
int HIGHEST = 4;
Random r = new Random();
generateRolledNumber(LOWEST, HIGHEST, r, player);
}
public static void rollDice2(Player player) {
if (!player.getInventory().containsOneItem(15086)){
return;
}
int LOWEST = 1;
int HIGHEST = 6;
Random r = new Random();
generateRolledNumber(LOWEST, HIGHEST, r, player);
}
public static void rollDice3(Player player) {
if (!player.getInventory().containsOneItem(15088)){
return;
}
int LOWEST = 1;
int HIGHEST = 12;
Random r = new Random();
generateRolledNumber(LOWEST, HIGHEST, r, player);
}
public static void rollDice4(Player player) {
if (!player.getInventory().containsOneItem(15090)){
return;
}
int LOWEST = 1;
int HIGHEST = 8;
Random r = new Random();
generateRolledNumber(LOWEST, HIGHEST, r, player);
}
public static void rollDice5(Player player) {
if (!player.getInventory().containsOneItem(15092)){
return;
}
int LOWEST = 1;
int HIGHEST = 10;
Random r = new Random();
generateRolledNumber(LOWEST, HIGHEST, r, player);
}
public static void rollDice6(Player player) {
if (!player.getInventory().containsOneItem(15094)){
return;
}
int LOWEST = 1;
int HIGHEST = 12;
Random r = new Random();
generateRolledNumber(LOWEST, HIGHEST, r, player);
}
public static void rollDice7(Player player) {
if (!player.getInventory().containsOneItem(15096)){
return;
}
int LOWEST = 1;
int HIGHEST = 20;
Random r = new Random();
generateRolledNumber(LOWEST, HIGHEST, r, player);
}
public static void rollDice8(Player player) {
if (!player.getInventory().containsOneItem(15098)){
return;
}
int LOWEST = 1;
int HIGHEST = 100;

Random r = new Random();
generateRolledNumber(LOWEST, HIGHEST, r, player);
}

private static void generateRolledNumber(int lowest, int highest, Random r, Player player) {
if (lowest > highest) {
return;
}
long range = (long) highest - (long) lowest + 1;
long fraction = (long) (range * r.nextDouble());
int numberRolled = (int) (fraction + lowest);
sendNumber(player, numberRolled);

}

private static void sendNumber(Player player, int numberRolled) {
player.getPackets().sendGameMessage(
"Rolling...");//can be deleted if you want
player.setNextForceTalk(new ForceTalk(
"rolled <col=FF0000>" + numberRolled + "</col> " + "on the percentile dice"));
player.getPackets().sendGameMessage(
"rolled <col=FF0000>" + numberRolled + "</col> " + "on the percentile dice");//correct message when number is rolled
}
}[/code] Edited by xCHRiS

Share this post


Link to post
Share on other sites
  • 0
You are missing a class then.

Share this post


Link to post
Share on other sites

×