Jump to content

How to build new rooms in player owned house?


Recommended Posts

Posted

Hey I am working on a construction script and want to know how to create new rooms automatically. Sometimes the rooms would get in the way and would have to be deleted or the portal room cannot be deleted so there are obstacles to handle. Also when it interacts with the door hotspots, how do you scroll down the list of rooms? Do I use mouse position and mouse click?

Posted

@Apaec Whenever I interact with the house viewer to add a room, the interact function would just pop up the option but not actually click on the "Add room" option. Here is my code:

RS2Widget createRoom = getWidgets().get(422, 5, 99);
if (createRoom != null && createRoom.interact("Add room")){

 

image.png

Posted
2 hours ago, R3G3N said:

@Apaec Whenever I interact with the house viewer to add a room, the interact function would just pop up the option but not actually click on the "Add room" option. Here is my code:


RS2Widget createRoom = getWidgets().get(422, 5, 99);
if (createRoom != null && createRoom.interact("Add room")){

 

image.png

Try doing something like, 

RS2Widget createRoom = getWidgets().get(422, 5, 99);
if (createRoom != null) {
	if (createRoom.interact("Add room")
		Sleep.sleepUntil(() -> someSortOfCheckToSeeIfTheRoomIsCreated, 1500, 250); //Or if you don't have the Sleep class for this you can do
		new ConditionalSleep(1500, 250) {
			public boolean condition() {
				return someSortOfCheckToSeeIfTheRoomIsCreated; //could be wrong on the syntax of this but it gives you an idea!
			}
		}
}

Also one thing I'd advice against is using widget ids as they can often change, so using text within the interface is always better!

Using the containingText# function

https://osbot.org/api/org/osbot/rs07/api/Widgets.html

Posted

There are no text widgets and that sleep condition is similar to what I have after I interact with the widget. My problem is that the interaction does not go through and just leaves the option menu hanging. I don't particularly have trouble with widgets in general. It is only this particular one that has a different behavior.

image.png.245f7db65f7462920824d7f7f4689b1a.png

These grid boxes are the widgets. They do not have any texts so I based them off their widget ids.

Posted
2 hours ago, R3G3N said:

There are no text widgets and that sleep condition is similar to what I have after I interact with the widget. My problem is that the interaction does not go through and just leaves the option menu hanging. I don't particularly have trouble with widgets in general. It is only this particular one that has a different behavior.

image.png.245f7db65f7462920824d7f7f4689b1a.png

These grid boxes are the widgets. They do not have any texts so I based them off their widget ids.

If you use the Widget debugger, you will find out there are multiple ways on how to detect a widget. You can also use position for example.

Posted
2 hours ago, R3G3N said:

There are no text widgets and that sleep condition is similar to what I have after I interact with the widget. My problem is that the interaction does not go through and just leaves the option menu hanging. I don't particularly have trouble with widgets in general. It is only this particular one that has a different behavior.

image.png.245f7db65f7462920824d7f7f4689b1a.png

These grid boxes are the widgets. They do not have any texts so I based them off their widget ids.

If it only has one option, can't you just left-click it using a WidgetDestination

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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