Hi, I rapidly need help!!! I have developed this game, (or the classes anyway) and the compiler just throws a bunch of crap at me when I try to compile it.

public class ship
        {
            public int fuel = 100;
            public int armour = 100;
            public int shields = 100;
            public int power = 100;
            public bool dead = false;
            public bool radprotect = false;
            
            public void laserdamage()
            {
                armour -= 30;
                power -= 10;
            }

            public void rocketdamage()
            {
                armour -= 50;
                power -= 20;
            }

            public void nukedamage()
            {
                dead = true;
            }           
        }
//Somewhere else...

ship player = new ship();
Console.Writeline(player.armour);

And it compiles sometimes but when it does it give me 5570268 as the value EVERYTIME!!! Help!!!
Also, if it helps, the "Somewhere else" is in another class, in my Main() function.

kvprajapati commented: Game-- -2

Recommended Answers

All 6 Replies

Error : Console.Writeline(player.armour);

Console.WriteLine(player.armour);

>when it does it give me 5570268 as the value EVERYTIME!!!

Impossible!!!

Yes it's possible! This is not actually the whole thing, it's part of my OS and it's like a game. You might wanna take a look at the source. I used Cosmos.

using System;
using Cosmos.Compiler.Builder;
using System.Threading;

namespace CosmosBoot1
{
    class Program
    {
        #region Cosmos Builder logic
        // Most users wont touch this. This will call the Cosmos Build tool
        [STAThread]
        static void Main(string[] args)
        {
            BuildUI.Run();
        }
        #endregion

        // Main entry point of the kernel
        public static void Init()
        {
            var xBoot = new Cosmos.Sys.Boot();
            xBoot.Execute();

            Console.Clear();
            Console.WriteLine("Entering safe-mode...");

            Console.WriteLine("Done.");

            Console.WriteLine("Calculating max RAM usage in this mode and initialising variables...");

            int filecount = 1;
            int usercount = 2;
            int numofprograms = 0;
            string[] namesoffiles = new string[1001];      //names of the files re stored in an array
            string[] filecontents = new string[1001];      //file contents are stored the same way, with a corresponding index
            string[] usernames = new string[6];
            string[] usernamepasses = new string[6];
            string[] novalevelstat = new string[2];
            initialise:
            usernames[0] = "root";
            usernames[1] = "standard";
            usernamepasses[0] = "sudoroot";
            usernamepasses[1] = "password";
            namesoffiles[0] = "testfile";
            filecontents[0] = "testfile";
            novalevelstat[0] = "0";
            filecount = 1;            //number of files, now its 0, universal
            usercount = 2;            //the two default users; standard and root
            numofprograms = 1;
            
            for (int i = 0; i < 100000; i++)
            {
                           //Spams for delay.
            }
            Console.WriteLine("Done.");
            Console.Clear();
            start1:
            Console.Clear();
            Console.WriteLine("XCube V3.47");
            Console.WriteLine("Type help for help");
            while (true)
            {

                start:
                usernames[0] = "root";
                usernamepasses[0] = "sudoroot";
                Console.ForegroundColor = ConsoleColor.White;
                Console.BackgroundColor = ConsoleColor.Black;

                Console.Write("Xcube $> ");         //prompt
                string command = Console.ReadLine();
                switch (command)
                {

                    case "help":
                        {
                            Console.WriteLine("manual-----Displays XCube manual");
                            Console.WriteLine("help-------Displays help");
                            Console.WriteLine("print------Prints text on screen");
                            Console.WriteLine("about------Displays version info");
                            Console.WriteLine("clr--------Clears the screen");
                            Console.WriteLine("mf---------Creates a file");
                            Console.WriteLine("vf---------Displays the contents of a file");
                            Console.WriteLine("df---------Deletes a file");
                            Console.WriteLine("pf---------Puts stuff into a file");
                            Console.WriteLine("rf---------Renames a file");
                            Console.WriteLine("format-----Deletes all files in your session");
                            Console.WriteLine("cube-------Starts XCube Graphical User Interface");
                            Console.Write("Press enter to continue...");
                            string help1=Console.ReadLine();
                            if (help1=="rootpassword")
                            {
                                Console.WriteLine("sudoroot");
                                Console.Write("Press enter to continue...");
                                Console.ReadLine();
                                break;
                            }
                            break;
                        }

                    case "print":
                        {
                            Console.Write("What to print: ");
                            string toprint = Console.ReadLine();

                            if (toprint == "helpmenow")
                            {
                                Console.WriteLine("Usage: What to print: [what you wanna print]");
                                break;
                            }

                            Console.WriteLine(toprint);
                            break;
                        }

                    case "clr":
                        {
                            Console.Clear();
                            Console.WriteLine("XCube V3.47");
                            Console.WriteLine("Type help for help");
                            break;
                        }
                    case "about":
                        {
                            Console.WriteLine("XCube Version 3.47, Build 0347");
                            Console.WriteLine("Development ID: XF347SY");
                            Console.WriteLine("Developer Version: X9JX4B");
                            Console.WriteLine("Model number: ZGMF-X47A");
                            Console.WriteLine("Serial number: SF92N");
                            Console.WriteLine("System type: SH021LKG");
                            Console.WriteLine("Maximum RAM handling: 128MB in VSF");
                            Console.WriteLine();
                            Console.WriteLine("Sole Developer: Zhia Yang");
                            Console.WriteLine("Bootloader: Self-Developed.");
                            Console.Write("Press enter to continue...");
                            Console.ReadLine();
                            break;
                        }



                    case "manual":
                        {
                            Console.WriteLine("There is no shutdown fuction for XCube. You have to press the button");
                            Console.WriteLine("on your PC. Likewise for a reboot.");
                            Console.WriteLine();
                            Console.WriteLine("When in doubt, always enter helpmenow as the parameter for the function.");
                            Console.WriteLine("Not all fuctions suuport that.");
                            Console.WriteLine("Also, consult this if in doubt as well.");
                            Console.WriteLine();
                            Console.WriteLine("Not all functions accept parameters. If needed, it will be asked for.");
                            Console.WriteLine("Note that ALL files created last for the current session only, as I have");
                            Console.WriteLine("not managed to create a filesystem, and all data is RAM based. File limit: ");
                            Console.WriteLine("your RAM.");
                            Console.WriteLine();
                            Console.WriteLine("Commands ARE case-sensitive. Typing help works, while HeLP does not.");
                            Console.WriteLine("Likewise for filenmes, if your filename was Bond, bond won't work.");
                            Console.WriteLine();
                            Console.WriteLine("XCube has 2 modes, a command line single-user interface, ");
                            Console.WriteLine("and a multi user text-based graphical user interface.");
                            Console.WriteLine("To start the GUI, simply type cube in the command line.");
                            Console.WriteLine("Default user is standard, password is password. You can make some more if you ");
                            Console.WriteLine("want to, but they will be lost if you format or shutdown. Please note that ");
                            Console.WriteLine("format command in the command line also deletes the users in the GUI.");
                            Console.WriteLine("Go figure out the password for user root, it has more functions, and you ");
                            Console.WriteLine("can't format XCube in the GUI as standard or any other user thats not root ");
                            Console.WriteLine("or of type root.");
                            Console.WriteLine("Note that you can have a MAX of 5 users.");
                            Console.Write("Press enter to continue...");
                            Console.ReadLine();
                            break;
                        }

                    default:
                        {
                            if (command == "nova")
                            {
                                novamenu();
                                break;
                            }


                            if (command == "format")
                            {
                                Console.Write("Are you sure?[Y/N] ");
                                string format1 = Console.ReadLine();

                                if (format1 == "Y" || format1 == "y")
                                {
                                    int temp3=0;

                                    for (temp3 = 0; temp3 < 1000; temp3++)
                                    {
                                        namesoffiles[temp3] = String.Empty;
                                        filecontents[temp3] = String.Empty;
                                        filecount=0;
                                        for(int temp5 = 0; temp5 < 5; temp5++)
                                        {
                                            usernames[temp5] = String.Empty;
                                            usernamepasses[temp5] = String.Empty;
                                        }
                                    }                                    
                                    Console.WriteLine("Operation Successful");
                                    goto initialise;
                                }
                                else if (format1 == "N" || format1 == "n")
                                {
                                    Console.WriteLine("Operation Cancelled");
                                    break;
                                }
                                else
                                {
                                    Console.WriteLine("Invalid choice");
                                    break;
                                }
                            }

                            if (command == "mf")
                            {
                                Console.Write("Name of file to create: ");
                                string mf1 = Console.ReadLine();

                                if (mf1 == "helpmenow")
                                {
                                    Console.WriteLine("Usage: Self-Explanatory");
                                    break;
                                }

                                namesoffiles[filecount] = mf1;
                                Console.WriteLine("File Created");
                                filecount++;
                                break;
                            }
                            if (command == "vf")
                            {
                                Console.Write("Name of file to View: ");
                                string vf1 = Console.ReadLine();

                                if (vf1 == "helpmenow")
                                {
                                    Console.WriteLine("Usage: Self-Explanatory");
                                    break;
                                }

                                int temp = 0;

                                while ((namesoffiles[temp] != vf1))
                                {
                                    temp++;
                                    if (temp > 1000)
                                    {
                                        Console.Write("Could not find file. Press enter to continue...");
                                        Console.ReadLine();
                                        goto start;
                                        
                                    }
                                    
                                    
                                }
                            

                                Console.WriteLine(filecontents[temp]);
                                break;
                            }

                            if (command == "pf")
                            {
                                Console.Write("Name of file to put stuff into: ");
                                string pf1 = Console.ReadLine();

                                if (pf1 == "helpmenow")
                                {
                                    Console.WriteLine("Usage: Self-Explanatory");
                                    break;
                                }

                                int temp1=0;
                                while ((namesoffiles[temp1] != pf1))
                                {
                                    temp1++;
                                    if (temp1 > 1000)
                                    {
                                        Console.Write("Could not find file. Press enter to continue...");
                                        Console.ReadLine();
                                        goto start;
                                    }
                                    
                                }
                                Console.Write("What to put into file: ");
                                string pf2 = Console.ReadLine();

                                filecontents[temp1] = pf2;
                                Console.WriteLine("Operation Successful");
                                break;
                            }

                            if (command == "df")
                            {
                                Console.Write("Name of file to delete: ");
                                string df1 = Console.ReadLine();

                                if (df1 == "helpmenow")
                                {
                                    Console.WriteLine("Usage: Self-Explanatory");
                                    break;
                                }

                                int temp2 = 0;
                                while ((namesoffiles[temp2] != df1))
                                {
                                    temp2++;
                                    if (temp2 > 1000)
                                    {
                                        Console.Write("Could not find file. Press enter to continue...");
                                        Console.ReadLine();
                                        goto start;
                                        
                                    }
                                    
                                    
                                    
                                }

                                Console.Write("Are you sure you want to delete that file?[Y/N]: ");
                                string df2=Console.ReadLine();

                                if (df2 == "Y" || df2 == "y")
                                {
                                    namesoffiles[temp2] = String.Empty;
                                    filecontents[temp2] = String.Empty;
                                    Console.WriteLine("Operation Successful");
                                    break;
                                }
                                else if (df2 == "N" || df2 == "n")
                                {
                                    Console.WriteLine("Operation Cancelled");
                                    break;
                                }
                                else
                                {
                                    Console.WriteLine("Invalid choice");
                                    break;
                                }
                                
                            }

                            if (command == "rf")
                            {
                                    Console.Write("Name of file to rename: ");
                                    string rename1 = Console.ReadLine();

                                    int temp13 = 0;
                                    while ((namesoffiles[temp13] != rename1))
                                    {
                                        temp13++;
                                        if (temp13 > 1000)
                                        {
                                            Console.Write("Could not find the specified file. Press enter to try again...");
                                            Console.ReadLine();
                                            break;
                                        }
                                    }


                                    Console.WriteLine();
                                    Console.Write("New name of file: ");
                                    string rename2 = Console.ReadLine();

                                    namesoffiles[temp13] = rename2;
                                    Console.Write("File renamed. Press enter to continue...");
                                    Console.ReadLine();
                                    break;

                            }


                            if (command == "cube")
                            {
                                cube:
                                Console.WriteLine("Starting the XCube GUI...");
                                Console.WriteLine("Done.");
                                Console.Clear();
                                Console.WriteLine("+-----------------------------+");
                                Console.WriteLine("|             XCube           |");
                                Console.WriteLine("|              GUI            |");
                                Console.WriteLine("|             V1.31           |");
                                Console.WriteLine("|                             |");
                                Console.WriteLine("+-----------------------------+");
                                for (int i = 0; i < 10000000;i++ )
                                {

                                }

                                while (true)
                                {
                                    login:
                                    Console.Clear();
                                    Console.WriteLine("XCube Graphical User Interface Login");
                                    Console.WriteLine();
                                    Console.WriteLine();
                                    Console.Write("Username: ");
                                    string user1 = Console.ReadLine();

                                    int temp4 = 0;
                                    while ((usernames[temp4] != user1))
                                    {
                                        temp4++;
                                        if (temp4 > 5)
                                        {
                                            Console.Write("No such user. Press enter to try again...");
                                            Console.ReadLine();
                                            goto login;
                                        }
                                    }

                                    Console.Write("Password: ");
                                    string password1 = Console.ReadLine();
                                    string currentuser = user1;
                                    if (password1 == usernamepasses[temp4])
                                    {
                                        
                                        goto pass;
                                    }
                                    else
                                    {
                                        goto fail;
                                    }

                                    fail:
                                    Console.WriteLine("Wrong password. Press enter to try again...");
                                    Console.ReadLine();
                                    goto cube;

                                    pass:
                                    Console.WriteLine("Logged in successfully");
                                    Console.Write("Press enter to continue...");
                                    Console.ReadLine();
                                    menu:
                                    Console.Clear();

                                    Console.WriteLine("+-----------------------------+");
                                    Console.WriteLine("| 1.File Operations           |");
                                    Console.WriteLine("| 2.Control Panel             |");
                                    Console.WriteLine("| 3.Exit to console           |");
                                    Console.WriteLine("+-----------------------------+");
                                    Console.Write("Choose an option: ");
                                    string choice1 = Console.ReadLine();

                                    switch (choice1)
                                    {
                                        case "1":
                                            {
                                                filemenu:
                                                Console.Clear();
                                                Console.WriteLine("+-----------------------------+");
                                                Console.WriteLine("| 1.New file                  |");
                                                Console.WriteLine("| 2.Edit file                 |");
                                                Console.WriteLine("| 3.Delete file               |");
                                                Console.WriteLine("| 4.View file                 |");
                                                Console.WriteLine("| 5.Rename file               |");
                                                Console.WriteLine("| 6.Exit to main menu         |");
                                                Console.WriteLine("+-----------------------------+");
                                                Console.Write("Choose an option: ");
                                                string choice2 = Console.ReadLine();
                                                

                                                switch (choice2)
                                                {
                                                    case "1":
                                                        {
                                                            Console.Clear();
                                                            Console.WriteLine("Xcube File Operations: New file");
                                                            Console.WriteLine();
                                                            Console.Write("Name of new file: ");
                                                            string newf1 = Console.ReadLine();
                                                            namesoffiles[filecount] = newf1;
                                                            filecount++;
                                                            Console.Write("File created. Press enter to continue...");
                                                            Console.ReadLine();
                                                            goto filemenu;

                                                        }
                                                    case "2":
                                                        {
                                                            editfile:
                                                            Console.Clear();
                                                            Console.WriteLine("XCube File Operations: Edit file");
                                                            Console.WriteLine();
                                                            Console.Write("Name of file to edit: ");
                                                            string edit1 = Console.ReadLine();

                                                            int temp6 = 0;
                                                            while ((namesoffiles[temp6] != edit1))
                                                            {
                                                                temp6++;
                                                                if (temp6 > 1000)
                                                                {
                                                                    Console.Write("Could not find the specified file. Press enter to try again...");
                                                                    Console.ReadLine();
                                                                    goto editfile;
                                                                }
                                                            }


                                                            Console.WriteLine();
                                                            Console.Write("Contents of file: ");
                                                            string edit2 = Console.ReadLine();

                                                            filecontents[temp6] = edit2;
                                                            Console.Write("File edited. Press enter to continue...");
                                                            Console.ReadLine();
                                                            goto filemenu;

                                                        }
                                                    case "3":
                                                        {
                                                            deletefile:
                                                            Console.Clear();
                                                            Console.WriteLine("XCube File Operations: Delete File");
                                                            Console.WriteLine();
                                                            Console.Write("Name of file to delete: ");
                                                            string deletef1 = Console.ReadLine();

                                                            int temp7 = 0;
                                                            while ((namesoffiles[temp7] != deletef1))
                                                            {
                                                                temp7++;
                                                                if (temp7 > 1000)
                                                                {
                                                                    Console.Write("Could not find file. Press enter to continue...");
                                                                    Console.ReadLine();
                                                                    goto deletefile;
                                                                }
                                                            }

                                                            Console.Write("Are you sure you want to delete that file?[Y/N]: ");
                                                            string deletef2 = Console.ReadLine();

                                                            if (deletef2 == "Y" || deletef2 == "y")
                                                            {
                                                                namesoffiles[temp7] = String.Empty;
                                                                filecontents[temp7] = String.Empty;
                                                                Console.WriteLine("File deleted. Press enter to continue...");
                                                                Console.ReadLine();
                                                                break;
                                                            }
                                                            else if (deletef2 == "N" || deletef2 == "n")
                                                            {
                                                                Console.WriteLine("File deletion cancelled");
                                                                break;
                                                            }
                                                            else
                                                            {
                                                                Console.Write("Invalid choice. Press enter to try again...");
                                                                Console.ReadLine();
                                                                goto deletefile;
                                                            }
                                                            
                                                        }
                                                    case "4":
                                                        {
                                                            viewfile:
                                                            Console.Clear();
                                                            Console.WriteLine("XCube File Operations: View file");
                                                            Console.WriteLine();
                                                            Console.Write("Name of file to view: ");
                                                            string viewf1 = Console.ReadLine();

                                                            int temp8 = 0;
                                                            while ((namesoffiles[temp8] != viewf1))
                                                            {
                                                                temp8++;
                                                                if (temp8 > 1000)
                                                                {
                                                                    Console.Write("Could not find file. Press enter to continue...");
                                                                    Console.ReadLine();
                                                                    goto viewfile;
                                                                }
                                                            }
                                                            Console.Clear();
                                                            Console.WriteLine("Here are its contents:");
                                                            Console.WriteLine();
                                                            Console.WriteLine(filecontents[temp8]);
                                                            Console.WriteLine();
                                                            Console.Write("Press enter to continue...");
                                                            Console.ReadLine();
                                                            goto filemenu;
                                                        }
                                                    case "5":
                                                        {
                                                            Console.Clear();
                                                            Console.WriteLine("XCube File Operations: Rename file");
                                                            Console.WriteLine();
                                                            Console.Write("Name of file to rename: ");
                                                            string ren1 = Console.ReadLine();

                                                            int temp11 = 0;
                                                            while ((namesoffiles[temp11] != ren1))
                                                            {
                                                                temp11++;
                                                                if (temp11 > 1000)
                                                                {
                                                                    Console.Write("Could not find the specified file. Press enter to try again...");
                                                                    Console.ReadLine();
                                                                    goto filemenu;
                                                                }
                                                            }


                                                            Console.WriteLine();
                                                            Console.Write("New name of file: ");
                                                            string ren2 = Console.ReadLine();

                                                            namesoffiles[temp11] = ren2;
                                                            Console.Write("File renamed. Press enter to continue...");
                                                            Console.ReadLine();
                                                            goto filemenu;

                                                        }

                                                    
                                                            
                                                    default:
                                                        {
                                                            if (choice2 == "6")
                                                            {
                                                                goto menu;
                                                            }

                                                            Console.Write("No such operation. Press enter to try again...");
                                                            Console.ReadLine();
                                                            goto filemenu;
                                                            
                                                        }
                                                }
                                                break;

                                            }
                                        case "2":
                                            {
                                                controlpanel:
                                                Console.Clear();
                                                Console.WriteLine("+-----------------------------+");
                                                Console.WriteLine("| 1.New user                  |");
                                                Console.WriteLine("| 2.Delete user               |");
                                                Console.WriteLine("| 3.Rename user               |");
                                                Console.WriteLine("| 4.Change password           |");
                                                Console.WriteLine("| 5.Format XCube              |");
                                                Console.WriteLine("| 6.Exit to main menu         |");
                                                Console.WriteLine("+-----------------------------+");
                                                Console.Write("Choose an option: ");
                                                string choice3 = Console.ReadLine();
                                                switch (choice3)
                                                {
                                                    case "1":
                                                        {
                                                            Console.Clear();
                                                            Console.WriteLine("XCube Control Panel: New user");
                                                            Console.WriteLine();
                                                            if (usercount > 5)
                                                            {
                                                                Console.WriteLine("You can only have a maximum of 5 users. Press enter to continue...");
                                                                Console.ReadLine();
                                                                goto controlpanel;
                                                            }
                                                            Console.Write("Name of the new user: ");
                                                            string newu1 = Console.ReadLine();

                                                            Console.Write("Password for the new user: ");
                                                            string newu2 = Console.ReadLine();

                                                            usercount++;
                                                            usernames[usercount] = newu1;
                                                            usernamepasses[usercount] = newu2;
                                                            Console.WriteLine("New user created");
                                                            Console.Write("Press enter to continue...");
                                                            Console.ReadLine();
                                                            goto controlpanel;


                                                        }

                                                    case "2":
                                                        {
                                                            Console.Clear();
                                                            Console.WriteLine("XCube Control Panel: Delete user");
                                                            Console.WriteLine();
                                                            Console.Write("Name of the user: ");
                                                            string deleteu1 = Console.ReadLine();

                                                            int temp10 = 0;
                                                            while ((usernames[temp10] != deleteu1))
                                                            {
                                                                temp10++;
                                                                if (temp10 > 5)
                                                                {
                                                                    Console.Write("The username does not exist. Press enter to continue...");
                                                                    Console.ReadLine();
                                                                    goto controlpanel;
                                                                }
                                                            }

                                                            if (currentuser == "root")
                                                            {
                                                                if (currentuser == "root" && deleteu1 == "root")
                                                                {
                                                                    Console.Write("You cannot delete the root user. Press enter to continue...");
                                                                    Console.ReadLine();
                                                                    goto controlpanel;
                                                                }
                                                                if (currentuser == deleteu1)
                                                                {
                                                                    Console.Write("You cannot delete the user you are lgged into. Press enter to continue...");
                                                                    Console.ReadLine();
                                                                    goto controlpanel;
                                                                }
                                                                goto somelabel2;
                                                            }

                                                            Console.Write("Password for the user: ");
                                                            string deleteu2 = Console.ReadLine();


                                                            if (deleteu2 == usernamepasses[temp10])
                                                            {
                                                                goto somelabel2;
                                                            }
                                                            else
                                                            {
                                                                goto somelabel3;
                                                            }


                                                            somelabel2:
                                                            Console.Write("User deleted. Press enter to continue...");
                                                            usercount--;
                                                            Console.ReadLine();
                                                            goto controlpanel;

                                                            somelabel3:
                                                            Console.Write("The password you entered is incorrect. Press enter to try again...");
                                                            Console.ReadLine();
                                                            goto controlpanel;


                                                        }

                                                    case "3":
                                                        {
                                                            Console.Clear();
                                                            Console.WriteLine("XCube Control Panel: Rename user");
                                                            Console.WriteLine();
                                                            Console.Write("Name of the user to rename: ");
                                                            string renameu1 = Console.ReadLine();

                                                            int temp9 = 0;
                                                            while ((usernames[temp9] != renameu1))
                                                            {
                                                                temp9++;
                                                                if (temp9 > 5)
                                                                {
                                                                    Console.Write("The username does not exist. Press enter to continue...");
                                                                    Console.ReadLine();
                                                                    goto controlpanel;
                                                                }
                                                            }

                                                            if (currentuser == "root")
                                                            {
                                                                goto somelabel1;
                                                            }

                                                            Console.Write("Password for the user: ");
                                                            string renameu2 = Console.ReadLine();

                                                            if (renameu2 == usernamepasses[temp9])
                                                            {
                                                                goto somelabel1;
                                                            }
                                                            else
                                                            {
                                                                Console.Write("The password you entered was incorrect. Press enter to try again...");
                                                                Console.ReadLine();
                                                                goto controlpanel;
                                                            }

                                                            somelabel1:
                                                            Console.Write("New name for the user: ");
                                                            string renameu3 = Console.ReadLine();
                                                            usernames[temp9] = renameu3;
                                                            Console.Write("Username changed successfuly. Press enter to continue...");
                                                            Console.ReadLine();
                                                            goto controlpanel;
                                                        }
                                                    case "4":                                                      
                                                        {
                                                            Console.Clear();
                                                            Console.WriteLine("XCube Control Panel: Change password");
                                                            Console.WriteLine();
                                                            Console.Write("Name of the user to change password: ");
                                                            string changeu1 = Console.ReadLine();

                                                            int temp12 = 0;
                                                            while ((usernames[temp12] != changeu1))
                                                            {
                                                                temp12++;
                                                                if (temp12 > 5)
                                                                {
                                                                    Console.Write("The username does not exist. Press enter to continue...");
                                                                    Console.ReadLine();
                                                                    goto controlpanel;
                                                                }
                                                            }


                                                            Console.Write("Password for the user: ");
                                                            string changeu2 = Console.ReadLine();

                                                            
                                                            if (currentuser == "root")
                                                            {
                                                                goto somelabel4;
                                                            }
                                                            if (changeu2 == usernamepasses[temp12])
                                                            {
                                                                goto somelabel4;
                                                            }
                                                            else
                                                            {
                                                                Console.Write("The password you entered was incorrect. Press enter to try again...");
                                                                Console.ReadLine();
                                                                goto controlpanel;
                                                            }

                                                            somelabel4:
                                                            Console.Write("New password for the user: ");
                                                            string changeu3 = Console.ReadLine();

                                                            
                                                            
                                                            Console.Write("Password changed. Press enter to continue...");
                                                            Console.ReadLine();
                                                            goto controlpanel;
                                                        }

                                                    default:
                                                        {
                                                            if (choice3 == "6")
                                                            {
                                                                goto menu;
                                                            }


                                                            if (choice3 == "5")
                                                            {
                                                            format1:
                                                                Console.Clear();
                                                                Console.WriteLine("XCube Control Panel: Format");
                                                                Console.WriteLine();
                                                                Console.Write("Password for root user: ");
                                                                string formp = Console.ReadLine();

                                                                if (formp == usernamepasses[0])
                                                                {
                                                                    goto somepassform;
                                                                }
                                                                else
                                                                {
                                                                    Console.Write("The password you entered was incorrect. Press enter to try again...");
                                                                    Console.ReadLine();
                                                                    goto controlpanel;
                                                                }

                                                            somepassform:
                                                                Console.Write("Are you sure?[Y/N] ");
                                                                string form1 = Console.ReadLine();

                                                                if (form1 == "Y" || form1 == "y")
                                                                {
                                                                    int temp15 = 0;

                                                                    for (temp15 = 0; temp15 < 1000; temp15++)
                                                                    {
                                                                        namesoffiles[temp15] = String.Empty;
                                                                        filecontents[temp15] = String.Empty;
                                                                        filecount = 0;

                                                                        for (int temp16 = 1; temp16 < 5; temp16++)
                                                                        {
                                                                            usernames[temp16] = String.Empty;
                                                                            usernamepasses[temp16] = String.Empty;
                                                                        }
                                                                    }
                                                                    Console.Write("Operation Successful. Press enter to continue...");
                                                                    Console.ReadLine();
                                                                    goto controlpanel;
                                                                }
                                                                else if (form1 == "N" || form1 == "n")
                                                                {
                                                                    Console.Write("Operation Cancelled. Press enter to continue...");
                                                                    Console.ReadLine();
                                                                    goto controlpanel;
                                                                }
                                                                else
                                                                {
                                                                    Console.Write("Invalid choice. Press enter to try again...");
                                                                    Console.ReadLine();
                                                                    goto format1;
                                                                }
                                                            }


                                                            Console.Write("No such operation. Press enter to try again...");
                                                            Console.ReadLine();
                                                            goto controlpanel;
                                                        }
                                                }
                                            }
                                        case "3":
                                            {
                                                goto start1;
                                                
                                            }
                                        default:
                                            {
                                                Console.Write("Not a valid choice. Press enter to continue...");
                                                Console.ReadLine();
                                                goto menu;
                                                
                                            }    

                                    }
                                    
                                }                               
                            }
                            Console.WriteLine("No such command");
                            break;
                        }
                }            
            }
        }

        public static void novamenu()
        {
            Console.Clear();
            Console.WriteLine();
            Console.WriteLine("Now starting Nova...");
            System.Threading.Thread.Sleep(5000);
            Console.WriteLine("Done.");
            novamenu:
            Console.Clear();
            Console.WriteLine();
            Console.WriteLine("Nova: E1 beta XX6");
            Console.WriteLine();
            Console.WriteLine("1.Start game");
            Console.WriteLine("2.Settings");
            Console.WriteLine("3.Exit Nova");
            Console.WriteLine();
            Console.Write("Choose an option: ");
            string nova1 = Console.ReadLine();

            switch (nova1)
            {
                case "1":
                    {
                        Console.Clear();
                        Console.WriteLine();
                        Console.WriteLine("Loading map [Tutorial]...");
                        Console.WriteLine("Done.");
                        spaceship s = new spaceship();
                        s.Fuel = 10;
                        int testing = s.Fuel;
                        Console.Write(testing);
                        Console.ReadLine();
                        break;
                    }
                case "2":
                    {
                        Console.Clear();
                        Console.WriteLine();
                        Console.WriteLine("Settings");
                        break;
                    }
                case "3":
                    {
                        Console.Clear();
                        Console.WriteLine();
                        Console.Write("Are you sure?[Y/N]: ");
                        string nova2 = Console.ReadLine();
                        if (nova2 == "y" || nova2 == "Y")
                        {
                            return;
                        }
                        else if (nova2 == "n" || nova2 == "N")
                        {
                            goto novamenu;
                        }
                        else
                        {
                            Console.Write("Invalid choice. Press enter to return to the main menu...");
                            Console.ReadLine();
                            goto novamenu;
                        }
                    }

                default:
                    {
                        Console.WriteLine("Invalid choice. Press enter to return to the main menu...");
                        Console.ReadLine();
                        goto novamenu;
                    }
            }
        }

        //define ship classes for Nova

        
    }
    public class spaceship
    {
        public int fuel = 100;
        public int armour = 100;
        public int shields = 100;
        public int power = 100;
        public bool dead = false;
        public bool radprotect = false;

        public int Fuel
        {
            get
            {
                return fuel;
            }
            set
            {
                fuel = value;
            }
        }

    }
}

Simple rule of C# programming language:

** All value types fields are automatically initialize with their default values and all reference types fields are automatically initialize with a spacial value - null. **

Here, instantiate the Ship class.

ship player = new ship();
Console.WriteLine(player.armour);

and it prints 100

But that's what I did!

ship player = new ship();
Console.WriteLine(player.armour);

requimrar, Its impressive that you put that much work into a cosmos build.

Its important to remember with cosmos that its C# when you write it. But its NOT c# when you compile it. It has its own compiler that uses C# syntax and creates an unmanaged 16bit executable. So its not always going to act the way you would expect it under the CLR that windows uses.

Thanks! :) So I see... Any suggestions for this problem? All help is greatly appreciated.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.