Official Everybody Edits Forums

Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?

You are not logged in.

#1 2015-03-19 12:21:53

goeyfun
Member
From: Mighty Japan
Joined: 2015-02-18
Posts: 667

Help .... Depsperate

do i need to eat medicine if i do this? //forums.everybodyedits.com/img/smilies/neutral

class Player
    {
        //stuffs
        public TrollData troll = new TrollData();
    }
class TrollData
    {
        public bool vertical { get; set; }
        public bool horizontal { get; set; }
        public bool straightline { get; set; }
        public bool filling { get; set; }
        public double blockdistance { get; set; }
        public int penalty { get; set; }
    }
Players.Add(e.GetInt(0), new Player()
                            {
                            }

how do i initiate the variables in the trolldata?


Ug3JzgO.png

Offline

#2 2015-03-19 12:39:14, last edited by Zumza (2015-03-19 12:40:39)

Zumza
Member
From: root
Joined: 2015-02-17
Posts: 4,656

Re: Help .... Depsperate

class TrollData
    {
        public bool vertical = false;
        public bool horizontal = false;
        public bool straightline = false;
        public bool filling = false;
        public double blockdistance = 1.0;
        public int penalty = 0;
    }

Whats wrong with this ^?
Also penalty should be a long long unsigned int trust me. //forums.everybodyedits.com/img/smilies/tongue

Edit: Or you mean a constructor?


Everybody edits, but some edit more than others

Offline

#3 2015-03-19 13:13:57

goeyfun
Member
From: Mighty Japan
Joined: 2015-02-18
Posts: 667

Re: Help .... Depsperate

Players.Add(e.GetInt(0), new Player()
                            {
                                username = e.GetString(1),
                                troll.penalty=0 //<-- i failed here
                            }

Ug3JzgO.png

Offline

#4 2015-03-19 15:31:38, last edited by Zumza (2015-03-19 15:33:33)

Zumza
Member
From: root
Joined: 2015-02-17
Posts: 4,656

Re: Help .... Depsperate

You can try this:

     Players.Add(e.GetInt(0), new Player(){
               username = e.GetString(1),
               troll = new TrollData(){

               }
     });

Everybody edits, but some edit more than others

Offline

#5 2015-03-19 15:34:55

goeyfun
Member
From: Mighty Japan
Joined: 2015-02-18
Posts: 667

Re: Help .... Depsperate

lol yes.... why am i so stupid.. forgot that basic logic...


Ug3JzgO.png

Offline

#6 2015-03-19 16:17:31, last edited by ewoke (2015-03-19 16:19:21)

ewoke
Member
Joined: 2015-02-20
Posts: 412

Re: Help .... Depsperate

class TrollData
    {
        public bool vertical { get; set; }
        public bool horizontal { get; set; }
        public bool straightline { get; set; }
        public bool filling { get; set; }
        public double blockdistance { get; set; }
        public int penalty { get; set; }
        public TrollData(bool v,bool h,bool s,bool f,double b,int p)
        {
                vertical = v;
                horizontal = h;
                straightline =s;
                filling = f;
                blockdistance = b;
               penalty  = p;
        }
    }
class Player
    {
        string name;
        Trolldata troll;
        public Player(string name, Trolldata troll)
        {
            this.name = name;
            this.troll = troll;
        }    
    }
player p = new player(m.getstring(1),new Trolldata(true,true,true,true,0,0));
players.add(m.getstring(0),p);

if you can read this....good for you

Offline

#7 2015-03-19 17:04:07

goeyfun
Member
From: Mighty Japan
Joined: 2015-02-18
Posts: 667

Re: Help .... Depsperate

thanks, very useful //forums.everybodyedits.com/img/smilies/wink


Ug3JzgO.png

Offline

goeyfun1426781047484528

Board footer

Powered by FluxBB

[ Started around 1732820265.5202 - Generated in 0.050 seconds, 13 queries executed - Memory usage: 1.4 MiB (Peak: 1.51 MiB) ]