Jump to content

HELP ! Code refuses to compile with no reason


Recommended Posts

OK, so I was trying to do a paraglider, it uses a Mumech toggle-like way of activating lift, but...

[...]

I really don\'t understand... references are set up correctly, and especially the two first errors... I compiled a plugin with the same 'protected override bool' and it worked fine, and in the MuMech toggle, angularDrag and other game values are never set but they\'re still accepted ?

Please help !

Code does not 'refuse to compile' with no reason.

Look closely and you\'ll see you\'re missing a semicolon.

Link to comment
Share on other sites

After onPartActivate(); ?

But there\'s still that deflectionLiftCoeff and parsing error...

You might want to work through a few basic tutorials of C# first before trying to code a plugin...

Basically, every instruction needs to be terminated with a semicolon. On a closer look, your code is missing even more than one.

Link to comment
Share on other sites

I would have to see the last corrected version of the code to find why it\'s still giving a compile error.

I believe what Corax was saying is that there are no such things as variables. Variables are a concept humans have. Code has no such concept, at least not in 'C' languages. C# is all about classes, which have objects inside them, and the classes themselves are also objects. You can define a custom object of a 'Type', create an 'Instance' of your object type, and assign a 'Value' to an instance of your object. However, those are three separate things you\'re telling the code to do, even if you write it all in a single line.


public class Class1
{
int a; //define a new Object called 'a' that is a thing of Type 'int'
protected void functionZ() //define a new Object called 'functionZ', () tells it this is a method thing that does something
{
int b; //creates a new Object called 'b' of Type 'int' that exists only inside this {} block, just like 'a' exists only in the class
b = new int();//This assigns the 'Symbol' or 'Object' 'b' to a new Instance of Type 'int', and gives it a spot in memory
//C# does the same thing with 'a' when you create an instance of the class, it just doesn\'t show the constructor here
a = 6; //assign the Value of 6 to the object 'a'
b = 8; //assign the Value of 8 to the object 'b'
int c = 5; //does everything above, but is written in a single line. It is still 3 separate steps however.
}
}

Apologies if I messed that up, or if you already understand this, just trying to be helpful. C# really isn\'t something I\'d suggest jumping directly into if you don\'t know some programming already.

Link to comment
Share on other sites

If you\'re still trying to find it, you need to look at the class itself, Emilio. I can\'t see what Parachutes is.

It\'s a game class. By example, if you want to do a command pod, you must type :


class MyCustomPod : CommandPod

Parachutes is the parachute module (don\'t ask me why there\'s an S...).

@Corax : Because a Bool is TRUE/FALSE/AND/OR/NO etc., from the boolean logic.

A float stores a decimal number.

Link to comment
Share on other sites

Oops, sorry. Thought it was a custom class, never looked at Parachutes before (and why is it plural?). I see exactly what Corax was saying now.

Use a new line inside onPartActivate(), and type

this.

If you\'re using VisualStudio at least, it\'ll give you a list of members contained in 'this' (make sure you actually type the '.') then try to find 'deflectionLiftCoeff'

Link to comment
Share on other sites

I\'m working on MonoDevelop...

Going to search the correspondant function on the net, but since I haven\'t access to my computer ATM (posting from mobile)...

You\'re right, Parachutes is the only module that is plural...

Link to comment
Share on other sites

'this' isn\'t a function, it\'s well, this. Mono may give the same helper popup, if not, you have to look through the declaration of Parachutes, and what Parachutes derives from, and try finding 'deflectionLiftCoeff'. It may also help to look at the declaration of Winglet.

Link to comment
Share on other sites

What Corax was saying is that you won\'t find it, because it\'s not a member of Parachutes, or Part. Winglet implements deflectionLiftCoeff, and somewhere in the code we can\'t see, it applies that value as a force to the part. If you want to derive from Parachutes, you need to implement deflectionLiftCoeff yourself, and make it do something with your own code. That can be done, but you can\'t know if it\'s done the same way Squad\'s code does it.

Link to comment
Share on other sites

Depends entirely on what you want it to do, I\'d suggest deriving from winglet and using the game code to handle lift. Otherwise, you\'d need to figure out all the atmospheric AoA drag lift pressure angular velocity stuff yourself. If that\'s what you want to do, all I can do is point you to this:

I managed to work that into actual engine code, but it was a ton of work. The vector is the direction; the length, or magnitude of the vector is the force; and the whole thing belongs in one of the FixedUpdate blocks.

Edit: You could look at how r4m0n switches the models in his Toggle class. The problem is that to use a winglet or control surface base, you have to handle the animation yourself. If you derive from parachute, you have to handle the physics yourself. Going to have to choose one.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...