Thread: [718]Dialogue with an object

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1 [718]Dialogue with an object 
    Registered Member
    Join Date
    Jun 2013
    Posts
    372
    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 itkilling.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
    Reply With Quote  
     

  2. #2  
    Success is the worst teacher

    Santa Hat's Avatar
    Join Date
    Oct 2012
    Age
    27
    Posts
    3,334
    Thanks given
    807
    Thanks received
    1,185
    Rep Power
    190
    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
    585
    Thanks given
    39
    Thanks received
    22
    Rep Power
    2
    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 itkilling.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
    not bad at all , thanks for contributing
    gave me an amazing idea!
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Mar 2013
    Posts
    22
    Thanks given
    1
    Thanks received
    0
    Rep Power
    11
    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  
    Donator
    Super Noodles's Avatar
    Join Date
    Sep 2013
    Age
    29
    Posts
    428
    Thanks given
    15
    Thanks received
    78
    Rep Power
    14
    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  
    Donator
    Super Noodles's Avatar
    Join Date
    Sep 2013
    Age
    29
    Posts
    428
    Thanks given
    15
    Thanks received
    78
    Rep Power
    14
    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
    248
    Thanks given
    93
    Thanks received
    38
    Rep Power
    0
    you should use eclipse auto fixes this error...
    Reply With Quote  
     

  8. #8  
    arr.each { |x| x }


    Join Date
    Jul 2013
    Posts
    1,388
    Thanks given
    190
    Thanks received
    345
    Rep Power
    2791
    Use eclipse.
    Reply With Quote  
     

  9. #9  
    BoomScape #1
    BoomScape's Avatar
    Join Date
    May 2013
    Posts
    2,422
    Thanks given
    289
    Thanks received
    234
    Rep Power
    48
    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
    Attached image
    Reply With Quote  
     

  10. #10  
    Donator


    Join Date
    Feb 2014
    Age
    25
    Posts
    605
    Thanks given
    22
    Thanks received
    40
    Rep Power
    145
    Basic tbh, but good job
    Reply With Quote  
     

Page 1 of 2 12 LastLast

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. how to change an objects name 718
    By Drathus Scape in forum Help
    Replies: 0
    Last Post: 12-12-2012, 12:52 AM
  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, 01: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
  •