June 13, 20187 yr 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?
June 13, 20187 yr IIRC there was an update where you can create, move around and delete rooms from an interface in the settings menu. That should be your starting point! Also, widgets are what you're looking for: https://osbot.org/api/org/osbot/rs07/api/Widgets.html Apa
June 15, 20187 yr Author @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")){
June 15, 20187 yr 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")){ 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
June 15, 20187 yr Author 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. These grid boxes are the widgets. They do not have any texts so I based them off their widget ids.
June 15, 20187 yr 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. 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.
June 15, 20187 yr 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. 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