Thread: [718]Dialogue with an object

Results 1 to 10 of 10
  1. #1 [718]Dialogue with an object 
    Registered Member
    Join Date
    Jun 2013
    Posts
    370
    Thanks given
    8
    Thanks received
    8
    Rep Power
    11
    This might has released before, or really easy or anything , but i just feel like to help beginners to try to make a simple dialogue with an object.

    I made a simple skilling dialogue , its working... but maybe you want to add more options or anything to it ... and change the teleports etc..

    Okay, first we have to make a class at :
    src\com\rs\game\player\dialogues

    name it:Skilling.java

    Code:
    package com.rs.game.player.dialogues;
    
    import com.rs.Settings;
    import com.rs.cache.loaders.NPCDefinitions;
    import com.rs.game.WorldTile;
    import com.rs.game.minigames.CastleWars;
    import com.rs.game.player.Skills;
    import com.rs.game.player.content.Magic;
    import com.rs.game.player.controlers.FightCaves;
    import com.rs.game.player.controlers.FightKiln;
    public class Skilling extends Dialogue { //credits to joseph2005h
    	
    	@Override 
    	 public void start() {
    	 sendDialogue(
    	 "<col=98CB46>Would you like to use skilling teleports?");
    
    	 }
    	@Override
    	public void run(int interfaceId, int componentId) {
    		if (stage == -1) {
    			sendEntityDialogue(SEND_1_TEXT_CHAT,
    					new String[] { player.getDisplayName(), "Sure, why not." },
    					IS_PLAYER, player.getIndex(), 9827);
    			stage = 1;
    		}
    		   if (stage == 1) {
    		sendOptionsDialogue("What would you like train?", "Magic",
    					"Herblore", "Firemaking", "Agility", "Mining");
    		
    		stage = 2;
    		  }
    		 if (stage ==2){
    			if (componentId == OPTION_1){ //Magic
    				Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(3094, 3502, 0));
    		}
    			
    			 if 	(componentId == OPTION_2){ //Herblore
    			Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(3094, 3502, 0));
    		
    		}	
    			}
    		
    			
    				
    				 if (componentId == OPTION_3){ //firemaking
    						Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(1701, 5600, 0));
    					}
    					
    				 if (componentId == OPTION_4){
    					stage = 3;
    					sendOptionsDialogue("Where would you like to go?", "barbarian", "Gnome training");
    					
    				}
    					 if(stage == 3){
    							if (componentId == OPTION_1){
    								Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(3094, 3502, 0));
    							}
    							else if (componentId == OPTION_2){
    								Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(3094, 3502, 0));
    							}
    							
    						}
    						
    					 if(componentId == OPTION_5){
    								stage = 4;}
    					 if (stage == 4){
    								sendOptionsDialogue("Where would you like to go?", "Desert camp Mining", "Mining guild");}
    								if(componentId == OPTION_1){
    									Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(3300, 3313, 0));
    								}
    								if(componentId == OPTION_2){
    									Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(3038, 9737, 0));
    								}
    							}			
    						
    	
    
    	@Override
    	public void finish() {
    		// TODO Auto-generated method stub
    		
    	}
    }

    Now , we have the dialogue .. but we need something that will start the dialogue.
    to do that we go to
    src\com\rs\net\decoders\handlers
    open objecthandler.java
    Code:
    				else if (id == put the object ID you want)
    					player.getDialogueManager().startDialogue("Skilling");
    now open dialoguehandler:
    add to it :
    Code:
    handledDialogues.put("Skilling", (Class<Dialogue>) Class.forName(Skilling.class.getCanonicalName()));

    Now you have a simple dialogue that starts when you click on an object

    enjoy :P
    Reply With Quote  
     

  2. #2  
    Success is the worst teacher

    Santa Hat's Avatar
    Join Date
    Oct 2012
    Age
    17
    Posts
    2,489
    Thanks given
    565
    Thanks received
    785
    Rep Power
    100
    The most basic thing but too many people forget/Don't know the dialoguehandler part so it may reduce some of the dialogue help threads

    Good job if it does help anyone
    Reply With Quote  
     

  3. #3  
    Registered Member Saddam's Avatar
    Join Date
    Jul 2013
    Posts
    363
    Thanks given
    19
    Thanks received
    9
    Rep Power
    3
    Quote Originally Posted by joseph2005h View Post
    This might has released before, or really easy or anything , but i just feel like to help beginners to try to make a simple dialogue with an object.

    I made a simple skilling dialogue , its working... but maybe you want to add more options or anything to it ... and change the teleports etc..

    Okay, first we have to make a class at :
    src\com\rs\game\player\dialogues

    name it:Skilling.java

    Code:
    package com.rs.game.player.dialogues;
    
    import com.rs.Settings;
    import com.rs.cache.loaders.NPCDefinitions;
    import com.rs.game.WorldTile;
    import com.rs.game.minigames.CastleWars;
    import com.rs.game.player.Skills;
    import com.rs.game.player.content.Magic;
    import com.rs.game.player.controlers.FightCaves;
    import com.rs.game.player.controlers.FightKiln;
    public class Skilling extends Dialogue { //credits to joseph2005h
    	
    	@Override 
    	 public void start() {
    	 sendDialogue(
    	 "<col=98CB46>Would you like to use skilling teleports?");
    
    	 }
    	@Override
    	public void run(int interfaceId, int componentId) {
    		if (stage == -1) {
    			sendEntityDialogue(SEND_1_TEXT_CHAT,
    					new String[] { player.getDisplayName(), "Sure, why not." },
    					IS_PLAYER, player.getIndex(), 9827);
    			stage = 1;
    		}
    		   if (stage == 1) {
    		sendOptionsDialogue("What would you like train?", "Magic",
    					"Herblore", "Firemaking", "Agility", "Mining");
    		
    		stage = 2;
    		  }
    		 if (stage ==2){
    			if (componentId == OPTION_1){ //Magic
    				Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(3094, 3502, 0));
    		}
    			
    			 if 	(componentId == OPTION_2){ //Herblore
    			Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(3094, 3502, 0));
    		
    		}	
    			}
    		
    			
    				
    				 if (componentId == OPTION_3){ //firemaking
    						Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(1701, 5600, 0));
    					}
    					
    				 if (componentId == OPTION_4){
    					stage = 3;
    					sendOptionsDialogue("Where would you like to go?", "barbarian", "Gnome training");
    					
    				}
    					 if(stage == 3){
    							if (componentId == OPTION_1){
    								Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(3094, 3502, 0));
    							}
    							else if (componentId == OPTION_2){
    								Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(3094, 3502, 0));
    							}
    							
    						}
    						
    					 if(componentId == OPTION_5){
    								stage = 4;}
    					 if (stage == 4){
    								sendOptionsDialogue("Where would you like to go?", "Desert camp Mining", "Mining guild");}
    								if(componentId == OPTION_1){
    									Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(3300, 3313, 0));
    								}
    								if(componentId == OPTION_2){
    									Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(3038, 9737, 0));
    								}
    							}			
    						
    	
    
    	@Override
    	public void finish() {
    		// TODO Auto-generated method stub
    		
    	}
    }

    Now , we have the dialogue .. but we need something that will start the dialogue.
    to do that we go to
    src\com\rs\net\decoders\handlers
    open objecthandler.java
    Code:
    				else if (id == put the object ID you want)
    					player.getDialogueManager().startDialogue("Skilling");
    now open dialoguehandler:
    add to it :
    Code:
    handledDialogues.put("Skilling", (Class<Dialogue>) Class.forName(Skilling.class.getCanonicalName()));

    Now you have a simple dialogue that starts when you click on an object

    enjoy :P
    not bad at all , thanks for contributing
    gave me an amazing idea!
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Mar 2013
    Posts
    3
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Hi i got everything to work correctly with compiling and such except for one thing...

    When i tried adding this code: handledDialogues.put("Skilling", (Class<Dialogue>) Class.forName(Skilling.class.getCanonicalName()));

    i got 1 error and i've tried to switch it around but nothing seems to work, so could you help me out by telling me how to fix this error. Apparently it cannot find the symbol??

    ::EDIT:: Never mind lol i fixed it.


    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Sep 2013
    Posts
    164
    Thanks given
    5
    Thanks received
    20
    Rep Power
    8
    Quote Originally Posted by daddy77 View Post
    Hi i got everything to work correctly with compiling and such except for one thing...

    When i tried adding this code: handledDialogues.put("Skilling", (Class<Dialogue>) Class.forName(Skilling.class.getCanonicalName()));

    i got 1 error and i've tried to switch it around but nothing seems to work, so could you help me out by telling me how to fix this error. Apparently it cannot find the symbol??

    ::EDIT:: Never mind lol i fixed it.


    Import Skilling.Java i believe
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Sep 2013
    Posts
    164
    Thanks given
    5
    Thanks received
    20
    Rep Power
    8
    Okay, say if i wanted to make a new dialogue after I've already got Skilling.Java, would i make a new class called ermmm for instance, Darkportal.Java?

    Also thanks, this helped alot
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Sep 2013
    Posts
    242
    Thanks given
    92
    Thanks received
    31
    Rep Power
    12
    you should use eclipse auto fixes this error...
    Reply With Quote  
     

  8. #8  
    Banned

    Join Date
    Jul 2013
    Posts
    1,291
    Thanks given
    138
    Thanks received
    249
    Rep Power
    0
    Use eclipse.
    Reply With Quote  
     

  9. #9  
    BoomScape #1
    Butt Naked's Avatar
    Join Date
    May 2013
    Posts
    1,364
    Thanks given
    125
    Thanks received
    105
    Rep Power
    15
    Quote Originally Posted by daddy77 View Post
    Hi i got everything to work correctly with compiling and such except for one thing...

    When i tried adding this code: handledDialogues.put("Skilling", (Class<Dialogue>) Class.forName(Skilling.class.getCanonicalName()));

    i got 1 error and i've tried to switch it around but nothing seems to work, so could you help me out by telling me how to fix this error. Apparently it cannot find the symbol??

    ::EDIT:: Never mind lol i fixed it.


    Importn skilling.java






    Reply With Quote  
     

  10. #10  
    Registered Member
    Join Date
    Feb 2014
    Posts
    97
    Thanks given
    0
    Thanks received
    1
    Rep Power
    40
    Basic tbh, but good job
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. how to change an objects name 718
    By Drathus Scape in forum Help
    Replies: 0
    Last Post: 12-11-2012, 11:52 PM
  2. 719+ How To Make Dialogue With Object
    By xelion in forum Snippets
    Replies: 15
    Last Post: 09-24-2012, 07:22 AM
  3. 718 adding an object to a new region
    By Goliath in forum Help
    Replies: 0
    Last Post: 08-29-2012, 03:16 AM
  4. 718 Need quick help with an error!
    By altiar in forum Help
    Replies: 2
    Last Post: 08-02-2012, 11:43 PM
  5. make an object teleport you with a list
    By OodlesOfNoodles in forum Help
    Replies: 2
    Last Post: 11-14-2011, 12:35 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
  •