Jump to content

Help Please


whipz

Recommended Posts

20 hours ago, Stimpack said:

what's the problem

 

editerino

from what i read you want to use a knife on item slot 27? sry if i misunderstood


if (getInventory().interact("Use", "Knife") && new ConditionalSleep(5_000) {
	@Override
	public boolean condition() throws InterruptedException {
		return getInventory().isItemSelected();
	}
}.sleep()) {
	final Item item = getInventory().getItemInSlot(27);
	if (item != null && getInventory().interact(27, "Use")) {
		log("KappaPride");
	}
}

 

Unfortunately this still doesn't work ): It says its going to use it but just spams my console saying using slot 27 but doesnt )':

Link to comment
Share on other sites

31 minutes ago, Stimpack said:

that's strange, the only thing that's logged to console is "KappaPride". you should probably check there's only 1 script in your script folder and it's the one you just compiled

Yeah i changed the log to using slot 27 it just sits the logging that constantly; was I ment to add something else to make it click the slot ? i just assumed .interact even in an if would run the interact part as well ? or am i mistaken 

Link to comment
Share on other sites

18 hours ago, Molly said:

	if (item != null && getInventory().interact(27, "Use")) {
		log("KappaPride");
	}

Do this instead:


if(item != null && item.interact()){


 

 

if (getInventory().interact("Use", "Knife") && new ConditionalSleep(5000) {
				@Override
				public boolean condition() throws InterruptedException {
					return getInventory().isItemSelected();
				}
			}.sleep()) {
				final Item item = getInventory().getItemInSlot(27);
				if (item != null && item.interact()) {
					log("Attempting to use slot 27");
					item.interact("Use");
				}
			}

This is what I have and for some reason it will log attempting to use slot 27 but it just stands there and does nothing ):

 

Link to comment
Share on other sites

1 hour ago, whipz said:

HOLY FUCK IM STUPID...... I just did a test

final String test = inventory.getIteminSlot(27).toString(); prints out slot 28....

I totally forgot that it goes 0 1 2 3 4 5 etc.... fuck sorry guys you were all right...

 

:doge:

editerino

java uses zero based indexing

here's a quote

Quote

The index in an array is not really an index. It is simply an offset that is the distance from the start of the array. The first element is at the start of the array so there is no distance. Therefore the offset is 0.

 

Edited by Stimpack
  • Like 1
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...