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!
Forum Resident
Original Poster
#1 Old 20th Oct 2020 at 6:05 AM Last edited by MissPat : 20th Oct 2020 at 6:15 AM.
Default Can't complete the Object Script Modding Tutorial
I'm trying to add a custom interaction to all "potty chair" objects.

I have followed the object script modding tutorial and managed to get a functional custom interaction class but I fail at the final step where the tutorial says to add the following line to the code:

Code:
        public override void OnStartup()
        {
            base.OnStartup();
            base.AddInteraction(PottyChairSomething.Singleton);
        }


When I follow the instructions, it fires up an error in Visual Studio: the word "void" gets highlighted and the error says "Error 1 Expected class, delegate, enum, interface, or struct".
Can you help me pinpoint what I'm doing wrong? I'm not sure how to get the game to load and recognize my interaction. I see that almost every modder is using the "kInstantiator" code but I have no idea how to achieve that.

Any help / insight would be very appreciated!
Advertisement
Lab Assistant
#2 Old 20th Oct 2020 at 8:23 AM
Quote: Originally posted by MissPat
I'm trying to add a custom interaction to all "potty chair" objects.

I have followed the object script modding tutorial and managed to get a functional custom interaction class but I fail at the final step where the tutorial says to add the following line to the code:

Code:
        public override void OnStartup()
        {
            base.OnStartup();
            base.AddInteraction(PottyChairSomething.Singleton);
        }


When I follow the instructions, it fires up an error in Visual Studio: the word "void" gets highlighted and the error says "Error 1 Expected class, delegate, enum, interface, or struct".
Can you help me pinpoint what I'm doing wrong? I'm not sure how to get the game to load and recognize my interaction. I see that almost every modder is using the "kInstantiator" code but I have no idea how to achieve that.

Any help / insight would be very appreciated!

I'm pretty new to script modding, but I believe you're supposed to place the interaction name that you defined earlier in your code on that line. For example, if you named your new interaction "Use The Potty", then the line of code would read base.AddInteraction(UseThePotty.Singleton)
Space Pony
#3 Old 20th Oct 2020 at 9:27 AM Last edited by Battery : 20th Oct 2020 at 10:27 AM.
Hi MissPat,

the biggest mistake is of course using VisualStudio beside that i can only spot minor issues like having the startup Method outside a class :P

Code:
using MyUsings;


namespace Sims3 .... .MissPatsObjectStuff
{
public class MyObject : DerivedFrom //This is the class you would derive from
{
            public override void OnStartup()
            {
                base.OnStartup();
                base.AddInteraction(PottyChairSomething.Singleton);
            }
}

}


The Instantiator is only needed for pure script mods to get the code into the game the objd takes care of that for you in object mods
Senior Moderator
staff: senior moderator
#4 Old 20th Oct 2020 at 3:51 PM
The object modding tutorial is for when you want to make a new object with a custom script, whereas when you want to add something to existing objects, you need to use pure modding (and that's why kInstantiator is used )

If you are wanting to add custom interactions to the existing in game potty chair, rather than making a custom potty, then you will need to use pure modding to add in the interaction to all potty chairs when the game loads, as well as adding an event listener to check for when a new object is bought - if it's a potty chair then the custom interaction will need to be added to that too.

Alternatively, I believe you could make a custom potty chair object (like how the object modding tutorial teaches), and then make a default replacement of the potty chair, changing the objk to reference your script. That way you'd replace the regular pottys instead of having a specific custom potty with your interaction, without needing to use pure modding. Though I've never tried it myself :p
Scholar
#5 Old 20th Oct 2020 at 6:12 PM
Yea what zoe22 said basically. The object interaction tutorial is if you want to create a custom object. Use this tutorial instead https://modthesims.info/showthread.php?t=491875 . You can add interations to objects as well with this tutorial.

If you like my mods. Consider supporting me on Patreon
Check out my website for updates on my mods and other work PuddingFace.wixsite.com
Check out my Youtube channel for tutorials(modding tutorials) and other content Youtube

Follow me on Twitter Instagram Pinterest Tumblr
Forum Resident
Original Poster
#6 Old 20th Oct 2020 at 9:51 PM
@Alunn: Thanks for the feedback, I did place the interaction name that I had defined earlier in my code on that line. Glad to know I'm not alone picking up script modding in 2020! Great to meet you.

@Battery: lol why do you think Visual Studio is a mistake? Do you mean I should use SharpDevelop instead? I'm not sure how the 2x compare. Also you made me realize that what I really want is to have a pure script mod.

@zoe22: thanks for explaining the difference between these 2 tutorials.

Quote:
Alternatively, I believe you could make a custom potty chair object (like how the object modding tutorial teaches), and then make a default replacement of the potty chair, changing the objk to reference your script. That way you'd replace the regular pottys instead of having a specific custom potty with your interaction, without needing to use pure modding. Though I've never tried it myself :p


I'd go for it if there was a tutorial out there breaking down the steps to follow but I don't know of any so I think I'll go for the pure scripting mod tutorial for now.

@PuddingFace: that's awesome, thanks for the link! It's exactly what I needed.

Thank you so much to all of you for your feedback, I really appreciate it! I was getting discouraged but I got my hopes up again, thanks to you.
Senior Moderator
staff: senior moderator
#7 Old 21st Oct 2020 at 2:41 PM
Pure modding is definitely a good way to go (and once you learn how it works you can use it for loads of other things!) but just FYI if you did want to try making a default replacement, here is a tutorial for going through the steps for that. Once you use the object modding tutorial, you might be able to just replace the one objk file to reference your script, or clone the whole package to make a replacement, which would give you the opportunity to make other changes if you wanted.

Looking forward to seeing more about what you're up to!
Forum Resident
Original Poster
#8 Old 21st Oct 2020 at 5:05 PM
I didn't have this tutorial, thank you so much @zoe22! New resource to try.
Space Pony
#9 Old 22nd Oct 2020 at 6:06 PM
Quote: Originally posted by MissPat
@Battery: lol why do you think Visual Studio is a mistake? Do you mean I should use SharpDevelop instead? I'm not sure how the 2x compare. Also you made me realize that what I really want is to have a pure script mod.


Well its just a joke, but im still baffled why so many modders are willing to create an account(with your data) to get an bloated slow ide that takes much more drive space than you need for sims 3 modding.

But to write something usefull, when youre done adding your ineractions to your target object dont forget to subscribe a method to an fitting event that keeps adding your method to newly created objects.

And good luck with your mod
Scholar
#10 Old 22nd Oct 2020 at 7:22 PM
Quote: Originally posted by Battery
Well its just a joke, but im still baffled why so many modders are willing to create an account(with your data) to get an bloated slow ide that takes much more drive space than you need for sims 3 modding.

But to write something usefull, when youre done adding your ineractions to your target object dont forget to subscribe a method to an fitting event that keeps adding your method to newly created objects.

And good luck with your mod


I wish I knew about Sharp Develop before getting Visual Studio. For some reason Visual Studio takes up over 100 GB of space. And even uninstalling won't clear that space

If you like my mods. Consider supporting me on Patreon
Check out my website for updates on my mods and other work PuddingFace.wixsite.com
Check out my Youtube channel for tutorials(modding tutorials) and other content Youtube

Follow me on Twitter Instagram Pinterest Tumblr
Space Pony
#11 Old 22nd Oct 2020 at 9:34 PM
Meh, I still use VS because it has Github integration and supports C# 6, 7 and 8. Not to mention it's preferable for literally anything beyond Sims 3 modding that utilizes C#.

"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
#12 Old 22nd Oct 2020 at 10:07 PM
Quote: Originally posted by gamefreak130
Not to mention it's preferable for literally anything beyond Sims 3 modding that utilizes C#.


Thats debatable, it might be true for yourself but i think its more a question of using the right tool for the job.
For my non Sims 3 c# usage it is more than sufficient (for now) and i don't need an IDE that uses at least 16 times the drivespace of SD and locks me into an account.

Long story short, gather what you want to do and choose your IDE depending your needs before you start.
Just make sure you make an informed decision.

Sorry for derailing this thread :p
Forum Resident
Original Poster
#13 Old 23rd Oct 2020 at 1:02 AM
All very good feedback! Nothing like a good heated conversation between a Battery and a gamefreak (see what I did there?).

I'll do more humbled modding attempts this week-end, I'm confident thanks to this thread that it can be successful this time around. Thank you!
Virtual gardener
staff: administrator
#14 Old 23rd Oct 2020 at 12:16 PM
Quote: Originally posted by PuddingFace
I wish I knew about Sharp Develop before getting Visual Studio. For some reason Visual Studio takes up over 100 GB of space. And even uninstalling won't clear that space
Huh that's really interesting actually! For me it was waaaaay less than that. (10GB at the most?) but I'm still using the 2017 version (used to do the 2013 one, but dark mode ftw!) 

Now the trick is, I've noticed that with Visual studio code, you end up with this checky box that basically wants you to install all the frameworks (Which is probably why you can't remove it unless you go ahead and uninstall them through window's uninstaller. You might see this listed with 'net framework 2.0' or whichever you've got installed). Visual studio has also really been focusing on all aspects of programming, which, I honestly think is a mistake, especially with visual studio code being around.

Speaking of visual studio code, I still need to give this a try, but I've personally been using this for work myself and love it a lot. Now this is just for HTML/CSS/JS so I don't know how it works with C# but I'm willing to try: https://code.visualstudio.com/docs/languages/csharp
It also comes with Github support  

But I do want to defend Sharp Develop in some sense though :p It's a great program that feels like it doesn't come with a lot of crap and just lets you code in peace. Especially for a game that still uses programming in how it was done back in 2008. And loves Net 2.0 :p
Scholar
#15 Old 23rd Oct 2020 at 3:28 PM
Quote: Originally posted by Lyralei
Huh that's really interesting actually! For me it was waaaaay less than that. (10GB at the most?) but I'm still using the 2017 version (used to do the 2013 one, but dark mode ftw!) 

Now the trick is, I've noticed that with Visual studio code, you end up with this checky box that basically wants you to install all the frameworks (Which is probably why you can't remove it unless you go ahead and uninstall them through window's uninstaller. You might see this listed with 'net framework 2.0' or whichever you've got installed). Visual studio has also really been focusing on all aspects of programming, which, I honestly think is a mistake, especially with visual studio code being around.

Speaking of visual studio code, I still need to give this a try, but I've personally been using this for work myself and love it a lot. Now this is just for HTML/CSS/JS so I don't know how it works with C# but I'm willing to try: https://code.visualstudio.com/docs/languages/csharp
It also comes with Github support  

But I do want to defend Sharp Develop in some sense though :p It's a great program that feels like it doesn't come with a lot of crap and just lets you code in peace. Especially for a game that still uses programming in how it was done back in 2008. And loves Net 2.0 :p


Yea I made a mistake with that. I think I also installed C++ and F#. I thought it would come in handy in the future.

If you like my mods. Consider supporting me on Patreon
Check out my website for updates on my mods and other work PuddingFace.wixsite.com
Check out my Youtube channel for tutorials(modding tutorials) and other content Youtube

Follow me on Twitter Instagram Pinterest Tumblr
Space Pony
#16 Old 23rd Oct 2020 at 4:17 PM
Quote: Originally posted by Lyralei
Speaking of visual studio code, I still need to give this a try, but I've personally been using this for work myself and love it a lot. Now this is just for HTML/CSS/JS so I don't know how it works with C# but I'm willing to try: https://code.visualstudio.com/docs/languages/csharp
It also comes with Github support


I use VSCode quite a bit and really like it as well, but while it is superior for web development I don't think it's as useful as a full IDE for script modding. It's lightweight and very extensible, sure, but even SD would have many quality-of-life advantages for both new and experienced modders. Lots of things that might take several steps in VSCode (creating new projects/solutions, refactoring, setting up build tasks, etc.) can be done in one click on an IDE.

Quote: Originally posted by PuddingFace
I think I also installed C++ and F#. I thought it would come in handy in the future.


F#? Coming in handy?

"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
Scholar
#17 Old 25th Oct 2020 at 10:42 AM
Nope never used it. I also didn't think that much space will be taken sigh

If you like my mods. Consider supporting me on Patreon
Check out my website for updates on my mods and other work PuddingFace.wixsite.com
Check out my Youtube channel for tutorials(modding tutorials) and other content Youtube

Follow me on Twitter Instagram Pinterest Tumblr
Back to top