Jump to content

How to build new rooms in player owned house?


R3G3N

Recommended Posts

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

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...