Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Test Subject
Original Poster
#1 Old 4th Jan 2019 at 2:55 PM
Default Python dialog boxes with input
Hi there,

I'm currently working on a proof of concept mod for adding some sort of basic mutliplayer into the sims, I've laid the ground work and can connect clients together, send messages etc.
At the moment all of this is done via commands in the console i.e. 'mp.host', 'mp.connect xxx', 'mp.chat xxx', etc. This also handles the creation of notifications too, i.e. when a user sends a message it creates a notification on the other clients etc.

I'm at the stage where I want to make this more user friendly, so everything isn't handled via the console and commands. I've created a factory class that makes the different types of ui elements to appear, for ease of use. This currently works with the notifications (as stated before), and then basic ok, ok/cancel dialog panels. I'm wanting to accept input into these dialog panels and have been messing around for hours trying to get it to work. I've taken a look in the `UiDialogTextInput` class and have tried using this, but to no avail. I'm generally ending up with the exception

Code:
Caught exception __init__() missing 1 required keyword-only argument: 'sort_order' 


I found an older thread which seemed to have quite a few answers before the November patch http://modthesims.info/t/547251

Without dumping the entire UI Factory script (as it's quite large) I'll share two of the methods from the class which give an example of what I'm trying to accomplish



If anyone has any experience with getting text inputs in a dialog working it would mean the world to me if you could help me out - thanks!
Advertisement
Deceased
#2 Old 4th Jan 2019 at 5:03 PM
Quote: Originally posted by StormBurpee
Code:
Caught exception __init__() missing 1 required keyword-only argument: 'sort_order' 

Ugh, I know that error well. You have two options, well three. First the one I wouldn't bother with:
  1. Keep plugging at it, there must be some logical way to get that tunable factory for the UiTextInput to work.
  2. Use the tactic I do in, e.g. Change Sim Name or Gender which is to create a UiTextInput without using the factory and assign the values to the majority of the attributes using direct assignments. It's ugly. It works though.
  3. What I would do if I was coding something new from scratch - create a module tuning for the mod and use an XML package to fill in those blanks rather than reinvent the wheel. Not even remotely ugly, and should definitely be more maintainable for future game patches. Unfortunately I do not have any currently published mods that use this method. I could be convinced to whip up an example - it wouldn't take much convincing because it's the "best way".

Test Subject
Original Poster
#3 Old 5th Jan 2019 at 1:04 AM Last edited by StormBurpee : 5th Jan 2019 at 2:09 AM.
Thanks for the reply Scumbumbo - I've been browsing this forum quite a bit lately and all your replies are super helpful. I'm interested to take a look at #3 as well, but probably in the interest of getting something together a lot quicker #2 might be my first go to.

I'll let you know how I go!

Update:
Got it working with method #2 - Thank you so much, such a relief after hours of work haha.
Once I've laid some more of the ground work, I do think I will dig into #3.
Deceased
#4 Old 5th Jan 2019 at 4:52 AM
Quote: Originally posted by StormBurpee
Got it working with method #2 - Thank you so much, such a relief after hours of work haha.
Once I've laid some more of the ground work, I do think I will dig into #3.


Glad to help. I'm going to create an example of using the module tuning for a notification now in another thread since that's something I've done and it's a breeze. Will work on one for actual dialogs after that, but I expect that should be equally easy other than probably requiring a callback of some sort.
Test Subject
Original Poster
#5 Old 5th Jan 2019 at 4:55 AM
That sounds awesome, I'll definitely follow along.
Deceased
#6 Old 5th Jan 2019 at 6:20 AM
It's posted. I think typing up the notes for it took longer than writing the code. You'll see it is really quite a breeze
Back to top