Unclear class creation
how would i go about resolving this error? This is what im getting: I believe I just need to define
Plugin Config
right? What would I need to do?46 Replies
Well where do you use
PluginConfig
?How are you compiling, also?
I'm using it in the creation of a config file, the only issue is that the plugin won't load if I don't define the
PluginConfig
class
Oxide compiler for rustThey upload the cs file to a server and it compiles it
it compiles C# 4.0 i believe
So you have the PluginConfig defiend but you can't reference it?
it's not defined at all which i had just recently noticed but i dont know how to define it
i know how to make a class
but i'm not sure what i put within the brackets of a class
fopr this specific thing
that would be based on how it's used in the rest of your plugin code
like i said in the other channel, seeing actual code would make this easier
yeah i was about to gimme a sec
i find it odd that you have code that uses a class that you haven't written yet
I'm reading documentation on how to add a config file but either I didn't see where to write a class or it's not included
im really new to C# and development in general
and the documentation doesn't provide you an actual implementation of this class?
the definition is basically this part where you can see the field names and types that this code expects the class to have
i don't think so, i can provide the link to the docs bc i might be overlooking
so you'd want to define a
PluginConfig
with those 6 properties and the types in the <> bracketsokay, copy + paste but in a new class
not quite copy and paste
elaborate
you can just infer how the class should look based on how it's used in my screenshot
you still have to define the actual fields/properties
that code initializes the object by setting those 6 properties, so they need to exist in the class definition
okay so i need to define each line but they should be their default values? I dont think im understanding correctly
it doesn't look like it matters whether you set defaults or not in your class because this code always sets them from whatever
Config
isokay
as an example a class with just the first property would look like
alright
i'll give this a shot and let you know what happens
this is giving me errors
Don't add those commas in
so i dont need any symbols to separate them
No
oh i dont lol
ok thx
Where are you defining it, I can't see?
does that not define it or something
that's not defining it, that's using it
it was working perfectly earlier so its confusing
oh ok
int numberOfF15s = 1
would be an example of defining (declaring and initializing) italr so i should declare this in the void of SpawnF15s, correct
in the void?
the private void whatever its called
ok i put it there
i'll let the server compile and see what it thinks
oh yeah it worked
thanks
Well,
private void SpawnF15s
is a method signature, then you have {}
to go around the method body, so I assume what you mean is you're putting it in the method bodyyeah lol idk what its called
depends how much you're looking to do with c#/programming overall but it might be an idea to get to grips with the fundamentals first!
yeah i really just started this project today with no knowledge of C# lmao
Definitely feels a bit like running before you can walk
it reads like python tbh it looks similar to me but i only know a bit
yeah but it was a fun day
especially when it just starts working after so much trial and error
but do you understand all the reasons why it didn't work, and all the things that then were changed to make it work?
yeah i do the way you explained it was helpful
Fair enough, I think you've just got to be careful you're not pushing through things you don't understand then just getting walked through the parts you get stuck on without fully taking it in
yea