R3G3N Posted June 13, 2018 Share Posted June 13, 2018 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? Quote Link to comment Share on other sites More sharing options...
Apaec Posted June 13, 2018 Share Posted June 13, 2018 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 1 Quote Link to comment Share on other sites More sharing options...
R3G3N Posted June 14, 2018 Author Share Posted June 14, 2018 Thanks for telling me! Did not know about that super convenient update! Quote Link to comment Share on other sites More sharing options...
R3G3N Posted June 15, 2018 Author Share Posted June 15, 2018 @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")){ Quote Link to comment Share on other sites More sharing options...
01053 Posted June 15, 2018 Share Posted June 15, 2018 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 Quote Link to comment Share on other sites More sharing options...
R3G3N Posted June 15, 2018 Author Share Posted June 15, 2018 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. Quote Link to comment Share on other sites More sharing options...
Canidae Posted June 15, 2018 Share Posted June 15, 2018 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. Quote Link to comment Share on other sites More sharing options...
FrostBug Posted June 15, 2018 Share Posted June 15, 2018 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 Quote Link to comment Share on other sites More sharing options...