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!
Quick Reply
Search this Thread
Lab Assistant
Original Poster
#1 Old 9th Feb 2020 at 8:20 PM
Default Sim Hover Tooltip
I want to make changes to the name tooltip that appears when cursor is hovered over any sim. I believe Sims3.Gameplay.Actors.Sim.CreateTooltip is the method.
@Arsil 's SIMpathy mod does it, but with Sim Display Window tooltip. Here is the part where it replaces the original with his version of the tooltip:
Code:
private static void ToolTipReplacerAlarmHandler()
{
	try
	{
		SimDisplay.Instance.mBustWin.CreateTooltipCallbackFunction = TooltipReplacer.CreateSIMpathyTooltip;
	}
	catch (Exception ex)
	{
		DebugMsg(ex.StackTrace);
	}
} 
Thought I could do it by replacing "SimDisplay.Instance.mBustWin.CreateTooltipCallbackFunction" with whatever calls the "Sims3.Gameplay.Actors.Sim.CreateTooltip" method. But I just can't find what calls it.
Advertisement
Space Pony
#2 Old 9th Feb 2020 at 10:28 PM
Quote: Originally posted by Slamyy
I want to make changes to the name tooltip that appears when cursor is hovered over any sim. I believe Sims3.Gameplay.Actors.Sim.CreateTooltip is the method.
@Arsil 's SIMpathy mod does it, but with Sim Display Window tooltip. Here is the part where it replaces the original with his version of the tooltip:
Code:
private static void ToolTipReplacerAlarmHandler()
{
	try
	{
		SimDisplay.Instance.mBustWin.CreateTooltipCallbackFunction = TooltipReplacer.CreateSIMpathyTooltip;
	}
	catch (Exception ex)
	{
		DebugMsg(ex.StackTrace);
	}
} 
Thought I could do it by replacing "SimDisplay.Instance.mBustWin.CreateTooltipCallbackFunction" with whatever calls the "Sims3.Gameplay.Actors.Sim.CreateTooltip" method. But I just can't find what calls it.


In short, I don't think you can without a core mod.

The sim bust elements reside on their own static (i.e. everpresent and unchanging) UI window, so their tooltips are generated using that window's CreateTooltipCallbackFunction; likewise, anything and everything that is not part of the UI resides on a static SceneManager window, but from what I gather, SceneManager implements the tooltip creation functions in such a way that its CreateTooltipCallbackFunction, although it could hypothetically exist, will never be called.

I could be wrong, though. You could always try something like this:
Code:
if (UIManager.GetSceneWindow() is SceneMgrWindow window)
{
    window.CreateTooltipCallbackFunction = CreateMyCustomTooltip;
}

But I'm almost certain that would have no effect.

"The Internet is the first thing that humanity has built that humanity doesn't understand, the largest experiment in anarchy that we have ever had." - Eric Schmidt

If you enjoy the mods I put out, consider supporting me on patreon: www.patreon.com/Gamefreak130
Lab Assistant
Original Poster
#3 Old 10th Feb 2020 at 5:36 PM
SharpDevelop gives a funny error at if statement, tells me to put a semicolon after round bracket VS doesn't give any error but I have reference problems with it so I can't try the code.
I don't want to make a core mode for just adding a text in the tooltips, couldn't there be a workaround?
Space Pony
#4 Old 10th Feb 2020 at 7:10 PM
Quote: Originally posted by Slamyy
SharpDevelop gives a funny error at if statement, tells me to put a semicolon after round bracket VS doesn't give any error but I have reference problems with it so I can't try the code.


Interesting, maybe SharpDevelop doesn't play well with pattern matching. @Battery can you confirm?

Try this instead:
Code:
SceneMgrWindow window = UIManager.GetSceneWindow();
window.CreateTooltipCallbackFunction = MyTooltipCallback;

This removes the null check, but if you wrap it in a try/catch block, it should be fine.

Quote: Originally posted by Slamyy
I don't want to make a core mode for just adding a text in the tooltips, couldn't there be a workaround?


Not if my theory is correct, no. Scene windows appear to be created and handled by the game engine, so if CreateTooltipCallbackFunction isn't being called at all, then the only thing that can be done is directly editing SceneWindow to call it again -- something that can only be done using a core mod.

"The Internet is the first thing that humanity has built that humanity doesn't understand, the largest experiment in anarchy that we have ever had." - Eric Schmidt

If you enjoy the mods I put out, consider supporting me on patreon: www.patreon.com/Gamefreak130
Space Pony
#5 Old 10th Feb 2020 at 8:01 PM Last edited by Battery : 10th Feb 2020 at 9:48 PM.
Quote: Originally posted by gamefreak130
Interesting, maybe SharpDevelop doesn't play well with pattern matching. @Battery can you confirm?


Type checks, with declarations of new variables are a feature of C#7.0 and up.
SharpDevelops highest supported Language version is C# 5.0 with the vanilla install.

If you use sharpdevelop im afraid you have to write one line of code extra

In my SpellCasting Util im "working on" i replaced the callbacks for the mouse behaviour but i think this would be way to much work for just replacing Tooltips if it is possible
Lab Assistant
Original Poster
#6 Old 13th Feb 2020 at 10:13 PM Last edited by Slamyy : 14th Feb 2020 at 5:17 AM.
Quote: Originally posted by Battery
In my SpellCasting Util im "working on" i replaced the callbacks for the mouse behaviour but i think this would be way to much work for just replacing Tooltips if it is possible

Since there is no other way, I can consider that. I would like to hear about it if you can make a progress.
EDIT: Ok, I have another idea. Would it be possible to make the game show a custom tooltip while hovered over with Shift pressed?
Space Pony
#7 Old 14th Feb 2020 at 2:42 PM Last edited by Battery : 14th Feb 2020 at 2:54 PM.
Quote: Originally posted by Slamyy
EDIT: Ok, I have another idea. Would it be possible to make the game show a custom tooltip while hovered over with Shift pressed?


This is the way im doing it for my spellcasting mouse alteration right now. This has the benefit that you dont need to rewrite everything. but be aware that the shift key is already used by the game. So its the same as overwriting the whole thing without shift but it doesnt need as many functions (if any) rewritten.
If you need more info let me know and i dig out the code i really should get working on again, before someone other than me claims first on the code i have created xd
Lab Assistant
Original Poster
#8 Old 14th Feb 2020 at 11:20 PM
If it won't be much trouble for you @Battery , I would like to know about your code Shift was just an example, it could be ctrl, alt or smt else.
Space Pony
#9 Old 16th Feb 2020 at 3:41 PM Last edited by Battery : 16th Feb 2020 at 8:57 PM.
Ok i didnt ge the Tooltip part itself, this could either be emulated or you could ask chainreaction over at nraas (i think he did something with tooltips a few years ago if i remember correctly) if you figured that part out and you want to share it i would be interested to see this since i couldnt find a quick solution yesterday

Step 0 Regeister a button to change the Mouse behavior and make a property for the SceneManager for faster Access:

Step 1 Switch The behaviuor on or off:

Step 2 Make a Method to Remov all delegates from the mousemove:


Step 3 Switch The behaviuor on or off:

Step 4 Display a Message when hoovering over a Sim(can be modified for any kind of GameObject):


Please dont use this code until i have updated my Utility mod and you go permission from me* ( with the exception of your tooltip endeavoour of course)

*eta: November 2057
Lab Assistant
Original Poster
#10 Old 17th Feb 2020 at 7:48 PM
Thanks @Battery , but I have tons of errors and questions.

I guess WriteNotification and ConversationMessaging are methods you wrote that are not included here.

It says "The event 'SceneMgrWindow.GameMouseMove' can only appear on the left hand side of += or -=" in these places:
Code:
MainSceneWindow.GameMouseMove = null; 
Code:
MainSceneWindow.GameMouseMove = (ScenePickHandler)Delegate.Combine(MainSceneWindow.GameMouseMove, new ScenePickHandler(MainSceneWindow.OnMouseMove)); 

I get "X does not contain a definition for Y" in these places (Y is underlined):
--->if (!UIManager.mEventRegistry.TryGetValue(win.WinHandle, out windowEventData))
--->MainSceneWindow.MouseMove -= MainSceneWindow.SceneMgrWindow_MouseMessage;
--->new ScenePickHandler(MainSceneWindow.OnMouseMove)
--->if (Target != null && id != SceneMgrWindow.sLastMousedOverObjectID)

I think in the below code you should remove the quotes. Also which button it corresponds to? And do you know the code of others?
Code:
switch (eventArgs.TriggerCode)
			{
				case "1913841967u": //This has to be the code in your trig resource (this is just for my mod so yours will vary)
                                         bUI.SwitchMouseDelegates(OnMouseMove,8u,false); //The Last boolean parameter sould be your toggle so you want to register a variable and toggle it
                                         break;
                         } 

I get "X is inaccessable due to its protection level" in many places:
--->UIManager.WindowEventData windowEventData;
--->UIEventHandlerGlueBase uIEventHandlerGlueBase;
--->if (!windowEventData.EventTypesAndCallbacks.TryGetValue(eventType, out uIEventHandlerGlueBase))
Space Pony
#11 Old 17th Feb 2020 at 8:32 PM Last edited by Battery : 17th Feb 2020 at 9:15 PM.
Hi @Slamyy,

i think most of the problems are caused the dll you use, now that i remember i made some modifications to it (i will try to attach my version to this post if the site lets me, otherwise see if the nraas ones are enough to get by)

the " " in the switch case are just there to show you that it is something you would have to change so it is not intended to be working code just yet. You can find the buttons in the trg Resources but i would create one myself if you tell me which button you want to press i can create an example for you and explain it (trigs are relatively easy)

try the modified dll first and tell me how far you get

E: i also attached one work in progress version of my Utility mod if you want to do a quick test

Code with the utility mod:
Attached files:
File Type: 7z  batterymod_UI.7z (767.9 KB, 8 downloads)
Description: self modified unprotected dll
File Type: 7z  Battery.Utility_1.0.2test03.package.7z (43.2 KB, 7 downloads)
Description: Extract the dll and just use bUI.SwitchMouseDelegates(OnMouseMove,MouseAction.MouseMove,false); to switch the delegate
Lab Assistant
Original Poster
#12 Old 18th Feb 2020 at 1:10 AM
@Battery Just replacing the UI with yours solved all the errors. Are you planning to make an extensive UI core mod? Cuz otherwise it's unpractical to override the UI with my puny mod.
Space Pony
#13 Old 18th Feb 2020 at 9:12 PM
I will stay away from core modding.
But if you do not want to implement the mouse alterations you can use the utility mod (the purpose of it was to aid modders who dont want to implement everything themselfs and provide a sort of easy access to some frequently used Functionality anyways).

I try to get a working version ready this weekend if you would like to use these features( just have to rearrange some namespaces and hirachies im not happy with.
i didnt do enough testing and many features are incomplete so i mark it as beta or something. If you want to give feedback or make suggestions for features you need/want implemented you would have my attention.
Lab Assistant
Original Poster
#14 Old 19th Feb 2020 at 3:00 AM
Oh so the Utility mod is supposed to work without your altered UI? I would definitely like to see it
Space Pony
#15 Old 22nd Feb 2020 at 9:21 AM Last edited by Battery : 22nd Feb 2020 at 1:51 PM.
Hi @Slammy,

i have uploaded a new beta version of my utility mod. You should not need the modified dll... at least i hope so if not let me know.

The new Code
Code:
using Battery.UI;
.
.
.
MouseUtil.SwitchMouseDelegates(OnMouseMove,MouseAction.MouseMove,false,true);
.
.
.

static void OnMouseMove(WindowBase sender, UIMouseEventArgs eventArgs)
{
	ulong id = MouseUtil.HitGameObjectID;
	ObjectGuid g = new ObjectGuid(id);
			
	Sim Target = GameObject.GetObject<Sim>(g);
	if(Target != null && id != MouseUtil.LastMousedOverObjectID)
	{
		MessageUtil.ConversationNotification(Target,Sim.ActiveActor,Target.FirstName);
		MouseUtil.LastMousedOverObjectID = id;
		return;
	}
}
Lab Assistant
Original Poster
#16 Old 23rd Feb 2020 at 7:36 PM
Tried the new code, world doesn't finish loading with it I'm also confused with the tooltip part. Could u take a look at it as well?
Space Pony
#17 Old 23rd Feb 2020 at 7:57 PM Last edited by Battery : 23rd Feb 2020 at 9:55 PM.
Quote: Originally posted by Slamyy
Tried the new code, world doesn't finish loading with it I'm also confused with the tooltip part. Could u take a look at it as well?


Hmm thats hard to tell whats going on there i have tested the utility before i uploaded it. Could you either upload your mod or post the code you are using ?

I havent created any tooltips in the example i gave since i assumed you had an idea how to do that ?

E: are you sure you have used the new utility mod as reference and not an old one ?

E2: ok got it, since i uploaded an experimental build i forgot to remove references to external resources i was working on. i will upload a cleaned version soon

E3: i just did a test where i removed this linked resources for me the game still loaded so it would still be nice to have your mod and have a look at it myself to figure out what the problem is
Lab Assistant
Original Poster
#18 Old 23rd Feb 2020 at 9:29 PM
I used the new Beta version of ur Utility mod and just with it, world loads fine. Things go bad when I add my own mod that uses it. Attached it for you.
Quote: Originally posted by Battery
I havnt created any tooltips in the example i gave since i assumed you had an idea how to do that ?

Yea I actually had an idea but I got confused now so thought you could help me a bit about that :D
EDIT: Seems like I have posted at the same time u edited :P
Attached files:
File Type: zip  BatteryHoverTest01.zip (2.7 KB, 8 downloads)
Space Pony
#19 Old 23rd Feb 2020 at 9:39 PM Last edited by Battery : 23rd Feb 2020 at 10:07 PM.
The game sometimes has problems with methods that are called directly with the onworldloadfinished method, instead call it a sim minute later.

Code:
using Sims3.Gameplay.Utilities;
.
.
.
private static void OnWorldLoadFinished(object sender, EventArgs e)
{
	AlarmManager.Global.AddAlarm (1f, TimeUnit.Minutes, new AlarmTimerCallback (CallMouseChange), "LoadUP", AlarmType.DeleteOnReset, null);
}
static void CallMouseChange()
{
	MouseUtil.SwitchMouseDelegates(OnMouseMove, MouseAction.MouseMove, false, true);
}


Dont ask me why creating messages directly with onworldload doesnt function either (not only with my mod but in gerneral)

Ok i just tested it without the timer the loading gets stuck at 99% with it will load and should work as expected, as for the tooltip part i think i have to ask Chainreaction myself
if he got custom tooltips to work. But you can ask him yourself at nraas if you have an account

E: i found the thread WOW this is more Ancient than i thought
Lab Assistant
Original Poster
#20 Old 23rd Feb 2020 at 10:06 PM
I just tested as well and works fıne thnx @Battery I don't have a nraas acc but I'll just create one.
Back to top