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!
Lab Assistant
Original Poster
#1 Old 24th May 2019 at 5:21 PM
Default I make a script from a hoverboard for motorcycles and bicycles, but I do not work the object in the game
Hi, i am 3ttu (mittsu (well you know, 三つ in japanese. its just sound like my own nickname - Mittz))!

I think it is worth saying that I do not know anything about coding, I couldn't even go because of illness for a couple of lessons at school on Basic, which was no more
Despite it all, looking at codes of the other guys on this site - I can quite understand what they meant (although, again, I don't understand everything because I have no experience with this. And this is my first.. code?)

I'm quite interested in coding and I've already looked through, probably, all the lessons here. I already have ideas for mods and this is one of them:

I love how these boards go flying everywhere. I want to make that motorcycles and bikes go also like.

I can buy an object in the shopping mode and my game don't crush, but when I put and hover the cursor over it - there is a hint with the his catalog.



To be honest, I'm sure it's done wrong, but I can't think of anything else to do with it... I hope for your help? below archive with files..
Sorry for English, it's not my native language :ь
Screenshots
Attached files:
File Type: rar  dll and package.rar (1.18 MB, 11 downloads) - View custom content
File Type: rar  vs project.rar (36.9 KB, 10 downloads) - View custom content
Advertisement
Virtual gardener
staff: administrator
#2 Old 24th May 2019 at 6:07 PM
Moooost of the time it's usually that the namespace + class isn't correctly noted. It is however really confusing when it happens. I took a peek and it seems you forgot a small bit to add, which is your user name

So, always remember to simply copy the correct namespace, because it's always your script's namespace + first class. So: Sims3.Gameplay.Objects.Miscellaneous.3ttu.MotorcycleChopper_DriveEverywhere

Hope that helps! I would recommend maybe removing the 3 from your namespace though. Visual studio and C# sees this as an integer and not necessarily a part of the string. So always make sure it's ONLY a string and NO numbers
Lab Assistant
Original Poster
#3 Old 24th May 2019 at 7:01 PM
Quote: Originally posted by Lyralei
Hope that helps! I would recommend maybe removing the 3 from your namespace though. Visual studio and C# sees this as an integer and not necessarily a part of the string. So always make sure it's ONLY a string and NO numbers


Oh, that's why my name was underlined in red in the project.. xD thanks, I didn't know this

Quote: Originally posted by Lyralei
Moooost of the time it's usually that the namespace + class isn't correctly noted. It is however really confusing when it happens. I took a peek and it seems you forgot a small bit to add, which is your user name

So, always remember to simply copy the correct namespace, because it's always your script's namespace + first class. So: Sims3.Gameplay.Objects.Miscellaneous.3ttu.MotorcycleChopper_DriveEverywhere


Sorry, so.. I correctly understand that I have to specify full path? like, so:
Code:
protected override string GetInteractionName(Sim a, Sims3.Gameplay.Objects.Miscellaneous.3ttu.MotorcycleChopper_DriveEverywhere target, InteractionObjectPair interaction)


Or i forgot my name in OBJK's resource?
Sorry, i not entirely understand.
Lab Assistant
Original Poster
#4 Old 25th May 2019 at 1:12 PM
I added a bit to the DLL, thinking that just "UseHoverboard" would not work.. but nothing has changed..
Attached files:
File Type: rar  dll and package 2.rar (1.18 MB, 7 downloads) - View custom content
Space Pony
#5 Old 25th May 2019 at 2:19 PM
hey 3ttu,

Lyralei is right you must not have your namespace begin with a digit see https://stackoverflow.com/questions...g-with-a-number.

And when i look at your dll there is nothing there. arent you getting any compile errors ? because i get a few when trying to compile your code.
Virtual gardener
staff: administrator
#6 Old 25th May 2019 at 2:55 PM
Objk indeed! In the code, you never want to ever have your namespace mentioned like that in a class. Not in this case at least. So this should always be just:
Code:
protected override string GetInteractionName(Sim a, MotorcycleChopper_DriveEverywhere target, InteractionObjectPair interaction)


Ah yeah I had a few warnings as well but somehow that did not enter my fried brain yesterday Good catch Battery

Indeed, there are a few issues in the script itself and C#/Visual studio is really strict when it comes to errors. For good reason too! It basically is a way Visual studio points out that it doesn't understand specific bits as well. Which means, C# doesn't get it, thus refuses to continue reading the script.

Now, most of these errors exist out of error mistakes really, and the lack of ending brackets at specific classes, which if you're new to coding is completely fine! I'll give one away though.

Code:
THIS: List<Hoverboard> list = sim.Inventory.FindAll<Hoverboard>(checkInUse: false);
SHOULD BE: List<Hoverboard> list = sim.Inventory.FindAll<Hoverboard>(checkInUse, false);


Why : ? Because it's an overload You can read more about them here: https://csharpindepth.com/articles/Overloading

If you wanna, I would really recommend checking out some basic C# videos, because it really does make your coding experience (or coding for ts3 in general) so much easier and you're starting to really understand what error means which, because they are indeed super vague. :P
Lab Assistant
Original Poster
#7 Old 25th May 2019 at 4:13 PM Last edited by 3ttu : 25th May 2019 at 5:45 PM.
Quote: Originally posted by Battery
hey 3ttu,

Lyralei is right you must not have your namespace begin with a digit see https://stackoverflow.com/questions...g-with-a-number.

And when i look at your dll there is nothing there. arent you getting any compile errors ? because i get a few when trying to compile your code.

Oh, I think I'm confusing this with "build-build solution" (F7)? :? sorry, I thought that was compile. ^^'

Quote: Originally posted by Lyralei
Objk indeed! In the code, you never want to ever have your namespace mentioned like that in a class. Not in this case at least. So this should always be just:
Code:
Code:
protected override string GetInteractionName(Sim a, MotorcycleChopper_DriveEverywhere target, InteractionObjectPair interaction)

I thought writing just "MotorcycleChopper_DriveEverywhere" was okay, because it's painted green, thx.

Quote: Originally posted by Lyralei
Why : ?Because it's an overload You can read more about them here:https://csharpindepth.com/articles/Overloading

Hm.. Interesing. thanku!

Quote: Originally posted by Lyralei
If you wanna, I would really recommend checking out some basic C# videos, because it really does make your coding experience (or coding for ts3 in general) so much easier and you're starting to really understand what error means which, because they are indeed super vague.:P

Oh, yeah, I was actually going! (actually, it was worth doing before I created this thread lol)
Lab Assistant
Original Poster
#8 Old 25th May 2019 at 4:40 PM
I tried to compile using the command line.. and there really are a lot of mistakes (not surprisingly). :/
Space Pony
#9 Old 25th May 2019 at 5:36 PM
Hey 3ttu,

you can compile without the command line via the ide.
In the ide i use f5 is the shortcut for compile and RUN.
The run part beeig the problem, since you cant "run" a dll. Visual studio should give you that feedback when you press f5. Try build project instead (that is if f5 really is build+run in visual studio).

You need to get rid of all the errors before the compile process finishes. So i would suggest starting at the first error the compiler throws out and work your way trough them till there are no errors left.
You might want to post the error messages here to let us help you if you get stuck or have a problem you cant solve yourself

hope your endeavors in the coding world begin to bear fruit soon
Lab Assistant
Original Poster
#10 Old 25th May 2019 at 6:09 PM
Quote: Originally posted by Battery
Hey 3ttu,

you can compile without the command line via the ide.
In the ide i use f5 is the shortcut for compile and RUN.
The run part beeig the problem, since you cant "run" a dll. Visual studio should give you that feedback when you press f5. Try build project instead (that is if f5 really is build+run in visual studio).

You need to get rid of all the errors before the compile process finishes. So i would suggest starting at the first error the compiler throws out and work your way trough them till there are no errors left.

but doesn't "build" just create a cs file? no compilation? when I build - VS says that there are no errors

Quote:
You might want to post the error messages here to let us help you if you get stuck or have a problem you cant solve yourself

thanks for the offer. if it's something I can't find or understand , I'll try asking here

Quote:
(that is if f5 really is build+run in visual studio).

when I wrote that comment I mixed up F5 and F7, although I kept it in my head.. :facepalm:

Quote:
hope your endeavors in the coding world begin to bear fruit soon

wow.. you think too well of me.XD although in fact, I also dream about this
Space Pony
#11 Old 25th May 2019 at 6:14 PM
Yeah sorry i just skimmed the text and didnt read the f7 part my bad.

so when you got your namespace fixed what errors are you getting ?
Lab Assistant
Original Poster
#12 Old 25th May 2019 at 8:32 PM
Quote: Originally posted by Battery
so when you got your namespace fixed what errors are you getting ?

You know, I created a new project and copied the code from the old one.. don't know why, but in the old I have, under "building" there were no errors, but now there are! basically, I fixed them and no more error alerts appear.

I don't understand these things now:

1) things highlighted in bold - gray, but if you remove them there or remove the "m" i have errors.. What to do?
Code:
        private static readonly string sLocalizationKey = "Gameplay/Objects/EP11/Hoverboard";
        public static bool kDebug = true;
        private bool mBeingPlaced;
        private bool mPlaced = true;
        private bool mUsingHoverboardAlways;
        private bool mUsingHoverboardOnLot;
        private bool mRestoreUseAfterRouting;


2) what are "m", "k", "t", etc.? m - main, k - key, t - target? where can I read about it?

3)it is normal that the DLL is not in
Code:
Documents\Visual Studio xxxx\Projects\{YourProjectName}\{yourprojectname}\bin\Release
(like here), but in
Code:
Documents\Visual Studio xxxx\Projects\{YourProjectName}\{yourprojectname}\bin\x86\Debug
?
Attached files:
File Type: rar  cs project 3.rar (511.8 KB, 9 downloads) - View custom content
File Type: rar  dll and package 3.rar (1.19 MB, 7 downloads) - View custom content
Lab Assistant
Original Poster
#13 Old 25th May 2019 at 8:50 PM
by the way! In OBJK a Script>String do I need to name as namespace (_3ttu_DriveEverywhere) in a project or as a project name (3ttu_DriveEverywhere.cs) or as a loaded DLL (3ttu_motorcycleChopper_DriveEverywhere.dll)? I'm little blunt..

now is .. oh i forgotten to change the name entirely and so there Sims3.Gameplay.Objects.Miscellaneous._3ttu.MotorcycleChopper_DriveEverywhere. :facepalm:
It should be Sims3._3ttu_DriveEverywhere?
Virtual gardener
staff: administrator
#14 Old 25th May 2019 at 10:09 PM
So the 'm, t, k' are actually variables, or for us to use them as things that need to hold data/info. Usually, at first, they're always set to 'false' or an empty string, 0 etc. the usage of this is basically... say, we want to store the name of a specific sim, and that name we want to use in different kind of functions, then you'd want to use a variable just for easier access really, and not having to copy paste any function/method to get the name constantly. If you REALLY want to remove the m, then you'll need to change this throughout your code (So within classes, functions, etc). I recommend not changing these at all really. You can read about them here: https://www.guru99.com/c-sharp-variables-operator.html

Regarding the export, I thiiiink that's probably because you set your active to 86x. Which is totally fine! As long as there is A dll then you're good I wouldn't advice saving it as a 64x one though, not sure if ts3 will like that...

In the OBJK You add the Namespace of your script + the Class (In your case indeed Sims3.Gameplay.Objects.Miscellaneous._3ttu.MotorcycleChopper_DriveEverywhere).

In the script itself whenever you mention the Target (Aka "Which object should I execute this function to?") Should always be MotorcycleChopper_DriveEverywhere
Lab Assistant
Original Poster
#15 Old 26th May 2019 at 8:43 PM Last edited by 3ttu : 26th May 2019 at 9:05 PM.
I was a little confused about String for OBJK AT first, but now I've fixed it and I can use the object in the game!
Because I copied the code from hoverboard - I have the applicable "to fly, not walk" and "walk"; when I press it on them, it only works on hoverboards so far.. but I will try to fix it!
(I think this and that this object goes on the road - depends on the subclass of the object, at present in my project it comes from a motorcycle)

UPD: i change it, but now sim is calling a taxi instead of using my moto in any variant.
is it because of these errors (it is highlighted in green wavy underline, but in the end still compiled) -
Code:
1>C:\Users\User\Documents\VS Projects\3ttu_DriveEverywhere\Class1.cs(360,32,360,63): warning CS0108: "MotorcycleChopper_DriveEverywhere.kHoverboardMedatorInstanceNames" скрывает наследуемый член "Hoverboard.kHoverboardMedatorInstanceNames". Если скрытие было намеренным, используйте ключевое слово new.

(just in case I leave it without translation) or because I need to make a new class (?) by type UsingHoverboard?
Virtual gardener
staff: administrator
#16 Old 30th May 2019 at 11:57 AM
So I took a look at the code and it seems that it needs geostates, which the motorcycle doesn't have. So I think creating a motorcycle like this is going to get a little trickier than expected. It's always super important to know what you're copying, understand what it's calling/expecting. Because else you're going to make it really tough on yourself.

I think what the warning is saying without having looked at that specific bit is the fact that the variable isn't correctly assigned I think. Unless it's linked with a constructor, which then you'd want to use the new keyword. It really is just figuring stuff out and debugging the hell out of it :P
Lab Assistant
Original Poster
#17 Old 6th Jun 2019 at 10:52 PM
Quote: Originally posted by Lyralei
So I took a look at the code and it seems that it needs geostates, which the motorcycle doesn't have. So I think creating a motorcycle like this is going to get a little trickier than expected. It's always super important to know what you're copying, understand what it's calling/expecting. Because else you're going to make it really tough on yourself.

I think what the warning is saying without having looked at that specific bit is the fact that the variable isn't correctly assigned I think. Unless it's linked with a constructor, which then you'd want to use the new keyword. It really is just figuring stuff out and debugging the hell out of it :P

Ah, that's why when I did manage to make the action work - the object (motorcycle) was not, and the animation from the hoverboard remained. it's logical.
By the way.. "posture" and "machine animation" as I understand things are different, but the motorcycle a have pose (if not mistaken). do I understand correctly that in this case, you will need to make separate animations based on the original? and why doesn't the "cool exhaust"function work? do i need to write separate code for this object? it seemed to me that if I will simply refer to this then the option will be. because I'm a genius, no less.

okay, thanks for your help, but I guess it not under force yet. initially I wanted to do it for the broom and bike, but when I wrote the post forgot about it.
Back to top