Thread: Dicing randomizer?

Results 1 to 9 of 9
  1. #1 Dicing randomizer? 
    Registered Member
    Join Date
    Jul 2011
    Posts
    45
    Thanks given
    0
    Thanks received
    3
    Rep Power
    1
    Code:
    public void removeDice(Client c, int item) {
    		int[] i = {15098, 15092, 15088, 15086};
    		for(int l = 0; l < i.length; l++) {
    			if(i[l] == item) {
    				c.getItems().deleteItem(i[l], c.getItems().getItemSlot(i[l]), 1);
    				c.getItems().addItem(15084, 1);
    				c.sendMessage("You put away the dies from the dice bag.");
    				break;
    			}
    		}
    	}
    
    	public int randomDiceType(Client c, int item) {
    		final int[][] DICE = {{15098, 100},{15086, 10}}; //TODO: Finish the dice random type
    		for(int i = 0; i < DICE.length; i++) {
    			if(item == DICE[i][0]) {
    				return DICE[i][1];
    			}
    		}
    		return 0;
    	}
    
    	public void rollDice(Client c, int item, boolean clanRoll) {
    		int randomDice = randomDiceType(c, item);
    		final int[] DICE = { 15098, 15086, 15088, 15092 };
    		for(int i = 0; i < DICE.length; i++) {
    			if(item == DICE[i]) {
    				if(c.clanId < 0 && clanRoll) {
    					c.sendMessage("You're can't roll a clan roll if you're not in a clan chat!");
    					return;
    				}
    				if(c.clanId >= 0 && !Server.clanChat.clans[c.clanId].owner.equalsIgnoreCase(c.playerName) 
    					&& System.currentTimeMillis() - c.diceDelay >= 5000 && clanRoll) {
    					c.sendMessage("Only the owner of the clan has the power to do that.");
    					return;
    				}
    				c.startAnimation(11900);
    				c.gfx0(2075);
    				c.sendMessage("I've rolled a "+ randomDice +" on the amount dice.");
    				c.diceDelay = System.currentTimeMillis();
    				if(clanRoll) {
    					Server.clanChat.messageToClan("" + c.playerName + " rolled a "+ randomDice +" on the amount dice.", c.clanId);
    				}
    				break;
    There you have it, Each time I am to roll the 100 sided dice, I'd always get 100.

    If you have any ideas, post down here. If you would like to see more, add me via MSN at "[email protected]" so we can discuss this further more.
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Jul 2011
    Posts
    91
    Thanks given
    8
    Thanks received
    0
    Rep Power
    8
    Code:
    Misc.random(100);
    ...Thats what I use lol.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Jul 2011
    Posts
    45
    Thanks given
    0
    Thanks received
    3
    Rep Power
    1
    Quote Originally Posted by tehhpro View Post
    Code:
    Misc.random(100);
    ...Thats what I use lol.
    Could you specify where you put that code?
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Jul 2011
    Posts
    91
    Thanks given
    8
    Thanks received
    0
    Rep Power
    8
    Just go to ClickItem.java and put this code in:

    Code:
    		if (itemId == 15098) {
    				c.forcedChat("ROLLED "+ Misc.random(100));
    				c.startAnimation(11900);
    				c.gfx0(2075);
    				}
    Im not sure what the exact coding was for my server, don't have the files on this computer, but I am sure you can figure it out.
    Reply With Quote  
     

  5. #5  
    Registered Member

    Join Date
    Dec 2008
    Posts
    1,010
    Thanks given
    0
    Thanks received
    1
    Rep Power
    271
    Replace with that:

    Code:
    public void removeDice(Client c, int item) {
    		int[] i = {15098, 15092, 15088, 15086};
    		for(int l = 0; l < i.length; l++) {
    			if(i[l] == item) {
    				c.getItems().deleteItem(i[l], c.getItems().getItemSlot(i[l]), 1);
    				c.getItems().addItem(15084, 1);
    				c.sendMessage("You put away the dies from the dice bag.");
    				break;
    			}
    		}
    	}
    
    	public int randomDiceType(Client c, int item) {
    		final int[][] DICE = {{15098, 100},{15086, 10}}; //TODO: Finish the dice random type
    		for(int i = 0; i < DICE.length; i++) {
    			if(item == DICE[i][0]) {
    				return DICE[i][1];
    			}
    		}
    		return 0;
    	}
    
    	public void rollDice(Client c, int item, boolean clanRoll) {
    		int randomDice = Misc.random(100);
    		final int[] DICE = { 15098, 15086, 15088, 15092 };
    		for(int i = 0; i < DICE.length; i++) {
    			if(item == DICE[i]) {
    				if(c.clanId < 0 && clanRoll) {
    					c.sendMessage("You're can't roll a clan roll if you're not in a clan chat!");
    					return;
    				}
    				if(c.clanId >= 0 && !Server.clanChat.clans[c.clanId].owner.equalsIgnoreCase(c.playerName) 
    					&& System.currentTimeMillis() - c.diceDelay >= 5000 && clanRoll) {
    					c.sendMessage("Only the owner of the clan has the power to do that.");
    					return;
    				}
    				c.startAnimation(11900);
    				c.gfx0(2075);
    				c.sendMessage("I've rolled a "+ randomDice +" on the amount dice.");
    				c.diceDelay = System.currentTimeMillis();
    				if(clanRoll) {
    					Server.clanChat.messageToClan("" + c.playerName + " rolled a "+ randomDice +" on the amount dice.", c.clanId);
    				}
    				break;
    Then go to the top of the file and add this with the other imports:

    Code:
    import server.util.Misc;
    In absence of a real father figure I looked to Dr House for guidance through my turbulent teenaged years.
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Jul 2011
    Posts
    45
    Thanks given
    0
    Thanks received
    3
    Rep Power
    1
    src\server\model\players\packets\ClickItem.java:38 : cannot find symbol
    symbol : variable Misc
    location: class server.model.players.packets.ClickItem
    c.forcedChat("ROLLED "+ Misc.random(100));
    ^
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    1 error
    Press any key to continue . . .
    Reply With Quote  
     

  7. #7 Hm? 
    Registered Member
    Join Date
    Jul 2011
    Posts
    45
    Thanks given
    0
    Thanks received
    3
    Rep Power
    1
    Quote Originally Posted by Bear Grylls View Post
    Replace with that:

    Code:
    public void removeDice(Client c, int item) {
    		int[] i = {15098, 15092, 15088, 15086};
    		for(int l = 0; l < i.length; l++) {
    			if(i[l] == item) {
    				c.getItems().deleteItem(i[l], c.getItems().getItemSlot(i[l]), 1);
    				c.getItems().addItem(15084, 1);
    				c.sendMessage("You put away the dies from the dice bag.");
    				break;
    			}
    		}
    	}
    
    	public int randomDiceType(Client c, int item) {
    		final int[][] DICE = {{15098, 100},{15086, 10}}; //TODO: Finish the dice random type
    		for(int i = 0; i < DICE.length; i++) {
    			if(item == DICE[i][0]) {
    				return DICE[i][1];
    			}
    		}
    		return 0;
    	}
    
    	public void rollDice(Client c, int item, boolean clanRoll) {
    		int randomDice = Misc.random(100);
    		final int[] DICE = { 15098, 15086, 15088, 15092 };
    		for(int i = 0; i < DICE.length; i++) {
    			if(item == DICE[i]) {
    				if(c.clanId < 0 && clanRoll) {
    					c.sendMessage("You're can't roll a clan roll if you're not in a clan chat!");
    					return;
    				}
    				if(c.clanId >= 0 && !Server.clanChat.clans[c.clanId].owner.equalsIgnoreCase(c.playerName) 
    					&& System.currentTimeMillis() - c.diceDelay >= 5000 && clanRoll) {
    					c.sendMessage("Only the owner of the clan has the power to do that.");
    					return;
    				}
    				c.startAnimation(11900);
    				c.gfx0(2075);
    				c.sendMessage("I've rolled a "+ randomDice +" on the amount dice.");
    				c.diceDelay = System.currentTimeMillis();
    				if(clanRoll) {
    					Server.clanChat.messageToClan("" + c.playerName + " rolled a "+ randomDice +" on the amount dice.", c.clanId);
    				}
    				break;
    Then go to the top of the file and add this with the other imports:

    Code:
    import server.util.Misc;
    It is already added there.
    Reply With Quote  
     

  8. #8  
    Registered Member

    Join Date
    Dec 2008
    Posts
    1,010
    Thanks given
    0
    Thanks received
    1
    Rep Power
    271
    Quote Originally Posted by op ninja View Post
    src\server\model\players\packets\ClickItem.java:38 : cannot find symbol
    symbol : variable Misc
    location: class server.model.players.packets.ClickItem
    c.forcedChat("ROLLED "+ Misc.random(100));
    ^
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    1 error
    Press any key to continue . . .
    Go to the top of your ClickItem file and add

    Code:
    import server.util.Misc;
    with your other imports

    Quote Originally Posted by op ninja View Post
    It is already added there.
    Well then you can skip that step :O
    In absence of a real father figure I looked to Dr House for guidance through my turbulent teenaged years.
    Reply With Quote  
     

  9. #9  
    Registered Member
    Join Date
    Jul 2011
    Posts
    45
    Thanks given
    0
    Thanks received
    3
    Rep Power
    1
    Quote Originally Posted by Bear Grylls View Post
    Go to the top of your ClickItem file and add

    Code:
    import server.util.Misc;
    with your other imports


    Well then you can skip that step :O
    Do you have teamviewer O_O? I can't seem to get my "ClanChat Dice" to work after I imported the ClanChatHandler.java

    Or...Possibly make it where I scream the lliving shit out myself those numbers.


    EDIT: NEVERMIND. THANKS GRYLLS, And your TV shows are fucking amazing.
    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. (PI) Gambling/Dicing.
    By `moh in forum Tutorials
    Replies: 51
    Last Post: 12-20-2012, 04:03 AM
  2. Rune-Server Dicing
    By Galkon in forum Chat
    Replies: 48
    Last Post: 09-27-2011, 08:56 PM
  3. [Pi] 60% Dicing
    By Kickyamom in forum Snippets
    Replies: 21
    Last Post: 08-20-2011, 02:46 AM
  4. [PI] Clan Dicing
    By Kaiser Btw in forum Snippets
    Replies: 19
    Last Post: 08-01-2011, 04:44 AM
  5. gfx for dicing?
    By `Michael in forum Requests
    Replies: 2
    Last Post: 07-12-2011, 10:26 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •