Jump to content

Anyone knows how to stop spam clicking an npc?


Sebastian

Recommended Posts

Good morning everyone (GMT+1). 

 

I'm currently studying program developing in The Netherlands. Which means i can just program OSbot scripts at school laugh.png

A classmate/friend of mine challenged me to make a tutorial island script, so he can do the tutorial that he doesn't want to do with hand.

I know there are scripts for Tutorial Island, but i'm making this for my own knowledge and will not post the script on the forums..

 

Now my question is: MyPlayer keeps clicking the guide. Like, spam clicking. I tried a lot of things to solve this.

At first i was like: I'm going to add a sleep timer. But this sleeps the whole script, and that's what we don't want.

 

Im clueless now lol.

 

This is my code: 

		if (spawnArea.contains(myPlayer())) {
			    NPC guide = npcs.closest("RuneScape Guide");
		        if(guide != null && !myPlayer().isInteracting(guide)){
		            guide.interact("Talk-To");    
		            // Need to do something here
		        }
		        if(guide != null && myPlayer().isInteracting(guide)) {
		        	dialogueGuide();
		        }
Edited by OSRS Sebastian
Link to comment
Share on other sites

 

ConditionSleep?

 

return if in dialogue

 

Still does the same.. I have tried the conditional sleep in both statements. didn't work.

		if (spawnArea.contains(myPlayer())) {
			    NPC guide = npcs.closest("RuneScape Guide");
		        if(guide != null && !myPlayer().isInteracting(guide)){
		            guide.interact("Talk-To");   
		            dialogueGuide();
					new ConditionalSleep(5000) {
						@Override
						public boolean condition() throws InterruptedException {
							return dialogues.inDialogue();
						}

					}.sleep();
		        }
		        if(guide != null && myPlayer().isInteracting(guide)) {
		        	dialogueGuide();
		        	
		        }
			}
Edited by OSRS Sebastian
Link to comment
Share on other sites

Does it click while talking or only before? If it spams before it's quite a human attribute which you should just roll with.

 

When in dialogue, it clicks the Tutorial Guy again and again and again and again.

 

So: Talking to the Tutorial Guy, open dialogue. Click next and clicks the tutorial guy again.

I need to somehow script it like: Only click Talk-To when i say so. 

 

Like: First stage: Click Tutorial guy.

        Second stage: Click on the settings tab

        Third stage: Click the Tutorial guy again

        Fourth stage: Click on the door and walk to the other tutorial guy.

Edited by OSRS Sebastian
Link to comment
Share on other sites

Yeah I remember it always says in dialogue because it shows the progress. I found this in my tut script, perhaps it's helpful:

 

if(dialogues.inDialogue() &&
            (widgets.get(372,0) == null || !widgets.get(372,0).isVisible()) &&
            (widgets.get(231,1) != null && widgets.get(231,1).isVisible())
            || widgets.get(219,0) != null && widgets.get(219,0).isVisible()) // tutorial messages

    {
    // in dialogue


    }

For the stages you want to use configs. configs.get(281) returns the current stage of tut island. You could then use the config debugger to determine the values.

Edited by Flamezzz
  • Like 1
Link to comment
Share on other sites

Yeah I remember it always says in dialogue because it shows the progress. I found this in my tut script, perhaps it's helpful:

 

if(dialogues.inDialogue() &&
            (widgets.get(372,0) == null || !widgets.get(372,0).isVisible()) &&
            (widgets.get(231,1) != null && widgets.get(231,1).isVisible())
            || widgets.get(219,0) != null && widgets.get(219,0).isVisible()) // tutorial messages

    {
    // in dialogue


    }

For the stages you want to use configs. configs.get(281) returns the current stage of tut island. You could then use the config debugger to determine the values.

 

Can you explain this better? I'm very new to scripting and i'm honest if i say that i don't understand the code you just posted nor the configs thing tongue.png . You can msg me if you like

Edited by OSRS Sebastian
Link to comment
Share on other sites

NPC#isInteracting doesn't do what you seem to think it does.

 

It will return the NPC guide while the player is 'focusing' him. But that focus is lost as soon as you've interacted with him. Instead you should check if the current dialogue contains whatever it is the guide says.

 

Also, to stop spam clicking, sleep for a bit after interacting. Either with a ConditionalSleep or a simple randomized sleep()

 

Edited by FrostBug
  • Like 1
Link to comment
Share on other sites

NPC#isInteracting doesn't do what you seem to think it does.

 

It will return the NPC guide while the player is 'focusing' him. But that focus is lost as soon as you've interacted with him. Instead you should check if the current dialogue contains whatever it is the guide says.

 

Also, to stop spam clicking, sleep for a bit after interacting. Either with a ConditionalSleep or a simple randomized sleep()

 

Thanks for the reply and information!

 

Is there some sort of tutorial on Dialogues and configs?

Link to comment
Share on other sites

Thanks for the reply and information!

 

Is there some sort of tutorial on Dialogues and configs?

 

I don't think there's any particular guide on configs. They're somewhat self explanatory though.

The game has a bunch of configs. A config (also called varpbits), is an integer packed with information used by the client. Eg. a bit register where each bit may have a specific meaning. They can be debugged with the client config debugger.

 

You can check if a dialogue with a certain text exists by getWidgets().containingText("Some dialogue text").isEmpty(), if this returned list is not empty, then the dialogue widget exists

 

  • Like 1
Link to comment
Share on other sites

I don't think there's any particular guide on configs. They're somewhat self explanatory though.

The game has a bunch of configs. A config (also called varpbits), is an integer packed with information used by the client. Eg. a bit register where each bit may have a specific meaning. They can be debugged with the client config debugger.

 

You can check if a dialogue with a certain text exists by getWidgets().containingText("Some dialogue text").isEmpty(), if this returned list is not empty, then the dialogue widget exists

 

 

This explains a lot! I'm going to give it a try!

 

EDIT: So just to be clear. Is the photo under this text a config? or is it when i talk to an npc?

 

mtm454.jpg

 

Thanks!

Edited by OSRS Sebastian
Link to comment
Share on other sites

 

Good morning everyone (GMT+1). 

 

I'm currently studying program developing in The Netherlands. Which means i can just program OSbot scripts at school laugh.png

A classmate/friend of mine challenged me to make a tutorial island script, so he can do the tutorial that he doesn't want to do with hand.

I know there are scripts for Tutorial Island, but i'm making this for my own knowledge and will not post the script on the forums..

 

Now my question is: MyPlayer keeps clicking the guide. Like, spam clicking. I tried a lot of things to solve this.

At first i was like: I'm going to add a sleep timer. But this sleeps the whole script, and that's what we don't want.

 

Im clueless now lol.

 

This is my code: 

		if (spawnArea.contains(myPlayer())) {
			    NPC guide = npcs.closest("RuneScape Guide");
		        if(guide != null && !myPlayer().isInteracting(guide)){
		            guide.interact("Talk-To");    
		            // Need to do something here
		        }
		        if(guide != null && myPlayer().isInteracting(guide)) {
		        	dialogueGuide();
		        }

 

In the case of Tutorial Island,  every interaction with an NPC is followed by the user selecting continue. So you can use:

final ConditionalSleep dialogSleep = new ConditionalSleep(5000) {
    @Override
    public boolean condition() throws InterruptedException {

        return script.getDialogues().isPendingContinuation();
    }
};
Edited by Explv
  • Like 1
Link to comment
Share on other sites

In the case of Tutorial Island, every interaction with an NPC is followed by the user selecting continue. So you can use:

final ConditionalSleep dialogSleep = new ConditionalSleep(5000) {    @Override    public boolean condition() throws InterruptedException {        return script.getDialogues().isPendingContinuation();    }};

Thanks bro! Will try this today when i wake up!

 

EDIT: Didn't have time to program today. Going to give it a shot again tomorrow! Will let you guys know.

Edited by OSRS Sebastian
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...