- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- Can't complete the Object Script Modding Tutorial
- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- Can't complete the Object Script Modding Tutorial
Replies: 16 (Who?), Viewed: 760 times.
#1
20th Oct 2020 at 6:05 AM
Last edited by MissPat : 20th Oct 2020 at 6:15 AM.
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 845
Thanks: 371 in 3 Posts
![Default](/images/icons/icon1.gif)
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
20th Oct 2020 at 8:23 AM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 212
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)
#3
20th Oct 2020 at 9:27 AM
Last edited by Battery : 20th Oct 2020 at 10:27 AM.
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 433
Thanks: 792 in 6 Posts
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
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
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
#4
20th Oct 2020 at 3:51 PM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 562
Thanks: 3599 in 11 Posts
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
![Smilie](http://static.modthesims2.com/images/smilies/smile.gif)
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
#5
20th Oct 2020 at 6:12 PM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 1,500
Thanks: 4283 in 41 Posts
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.
#6
20th Oct 2020 at 9:51 PM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 845
Thanks: 371 in 3 Posts
@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.
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.
@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.
#7
21st Oct 2020 at 2:41 PM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 562
Thanks: 3599 in 11 Posts
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!
Looking forward to seeing more about what you're up to!
#8
21st Oct 2020 at 5:05 PM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 845
Thanks: 371 in 3 Posts
I didn't have this tutorial, thank you so much @zoe22! New resource to try.
#9
22nd Oct 2020 at 6:06 PM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 433
Thanks: 792 in 6 Posts
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
#10
22nd Oct 2020 at 7:22 PM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 1,500
Thanks: 4283 in 41 Posts
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
![Sad](http://static.modthesims2.com/images/smilies/icon9.gif)
#11
22nd Oct 2020 at 9:34 PM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 437
Thanks: 5334 in 22 Posts
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
If you enjoy the mods I put out, consider supporting me on patreon: www.patreon.com/Gamefreak130
#12
22nd Oct 2020 at 10:07 PM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 433
Thanks: 792 in 6 Posts
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
#13
23rd Oct 2020 at 1:02 AM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 845
Thanks: 371 in 3 Posts
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!
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!
#14
23rd Oct 2020 at 12:16 PM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 3,860
Thanks: 8546 in 67 Posts
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 ![]() |
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
![Wink](http://static.modthesims2.com/images/smilies/icon_smile_wink.gif)
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
#15
23rd Oct 2020 at 3:28 PM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 1,500
Thanks: 4283 in 41 Posts
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.
#16
23rd Oct 2020 at 4:17 PM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 437
Thanks: 5334 in 22 Posts
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?
![lol](http://static.modthesims2.com/images/smilies/lol.gif)
"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
If you enjoy the mods I put out, consider supporting me on patreon: www.patreon.com/Gamefreak130
#17
25th Oct 2020 at 10:42 AM
![Old](/static/images/buttons/buttons-rro/images/statusicon/post_old.gif)
Posts: 1,500
Thanks: 4283 in 41 Posts
Nope never used it. I also didn't think that much space will be taken sigh
Who Posted
|