- Site Map >
- Modding and Creation >
- Sims 4 Creation >
- Modding Discussion >
- Injecting String into Notification
- Site Map >
- Modding and Creation >
- Sims 4 Creation >
- Modding Discussion >
- Injecting String into Notification
Replies: 1 (Who?), Viewed: 524 times.
#1
11th Jan 2021 at 3:39 AM
Posts: 5
Injecting String into Notification
I want to show a notification with "The selected member of the household is {0.String}" where 0.String would be a random household member's name. I already have to code to get the sims name, I just need to show it on the notification. Below is the main part of my notification code. Also when I do .show_dialog() without any parameters, I just get a blank notification box. I am thinking it is how I set notification but I am not sure.client = services.client_manager().get_first_client()
localized_title = lambda **_: sims4.localization._create_localized_string(title)
localized_text = lambda **_: sims4.localization._create_localized_string(text)
notification = UiDialogNotification.TunableFactory().default(client.active_sim, text=localized_text,
title=localized_title)
The variable "extra" in this situation is the name of the sim.
Traceback (most recent call last):
File "PATH", line 76, in reality_show_test2
realityshow_notification(lowest["sim_name"], title=52448544, text=52146384)
File "PATH", line 123, in realityshow_notification
notification.show_dialog(additional_tokens=(extra,))
File "T:\InGame\Gameplay\Scripts\Server\ui\ui_dialog.py", line 583, in show_dialog
File "T:\InGame\Gameplay\Scripts\Server\ui\ui_dialog.py", line 382, in show_dialog
File "T:\InGame\Gameplay\Scripts\Server\ui\ui_dialog_service.py", line 91, in dialog_show
File "T:\InGame\Gameplay\Scripts\Server\ui\ui_dialog_notification.py", line 135, in build_msg
File "T:\InGame\Gameplay\Scripts\Server\ui\ui_dialog.py", line 655, in build_msg
File "T:\InGame\Gameplay\Scripts\Server\ui\ui_dialog.py", line 601, in _build_localized_string_msg
TypeError: <lambda>() takes 0 positional arguments but 1 was given
Advertisement
#2
13th Jan 2021 at 1:42 AM
Posts: 5
For future reference, I found that this code here worked. It is the code from scumbumbo on 11/17/2018
https://modthesims.info/showthread.php?t=544445
https://modthesims.info/showthread.php?t=544445
Who Posted
|