Nurglini
Nurglini
CC#
Created by Nurglini on 9/5/2024 in #help
How do you declare an Array's Count property to be consistent within a Struct?
Mmm, but I could still do loc.Value[1] = n, kk, sweet
16 replies
CC#
Created by Nurglini on 9/5/2024 in #help
How do you declare an Array's Count property to be consistent within a Struct?
Well, I still want to be able to set the Values, wouldn't this disallow that?
16 replies
CC#
Created by Nurglini on 11/24/2023 in #help
Can you store a unique function within a class?
As a follow up to this, I have what feels like a niche issue at the moment - is there a way I can reference a parent class's variable within this subclasses action? I haven't been able to figure out how to access one of my Entities variables from the Ability's action (I.e. retrieving entity's health variable and modifying that from the entity's ability's action)
7 replies
CC#
Created by Nurglini on 11/24/2023 in #help
Can you store a unique function within a class?
I did some extra reading up on actions and this seems prime, thank you very much!
7 replies
CC#
Created by Nurglini on 10/25/2023 in #help
Is there a 'foreach' equivalent for parts of a class?
Thanks
48 replies
CC#
Created by Nurglini on 10/25/2023 in #help
Is there a 'foreach' equivalent for parts of a class?
Ah, so there isn't a more efficient way than doing it manually
48 replies
CC#
Created by Nurglini on 10/25/2023 in #help
Is there a 'foreach' equivalent for parts of a class?
Yes but I would need to enter that manually for each property, I'm asking if there's a way to input a class and perform the function for each property, regardless of how many there are or what their names are.
48 replies
CC#
Created by Nurglini on 10/25/2023 in #help
Is there a 'foreach' equivalent for parts of a class?
The items ID, Name, Turns, etc.
48 replies
CC#
Created by Nurglini on 10/25/2023 in #help
Is there a 'foreach' equivalent for parts of a class?
That's neat, but I would still have to go through each individual element, wouldnt I?
48 replies
CC#
Created by Nurglini on 10/25/2023 in #help
Is there a 'foreach' equivalent for parts of a class?
I am aware that a foreach style system would need to be sure to not edit Data as its a part of the class
48 replies
CC#
Created by Nurglini on 10/25/2023 in #help
Is there a 'foreach' equivalent for parts of a class?
int Counter;
string[] NameOptions = {"Jim", "Kim",..};
public class Stored
{
public string ID;
public string Name;
public string Turns;
public string Health;
public string Size;
public string Data;
}
List<Stored> AllItems = new List<Stored>();

void GenerateStored(int number)
{
if(Counter < 99)
{
for (int i = 0; i < number; i++;)
{
Stored temp = new Stored() {ID = Counter.ToString(), Name = Random.Range(0, NameOptions.Length).ToString(),.../*etc. for everything except 'Data'*/}
StoredDataSet(temp);

AllItems.Add(temp)

}
}
}

void StoredDataSet(Stored l)
{
Stored temp = l;
if(Convert.ToInt16(temp.ID) < 10)
{
temp.ID = '0' + temp.ID;
}
if(Convert.ToInt16(temp.Name) < 10)
{
temp.Name = '0' + temp.Name;
}
...
/*^This all is what I'd like to streamline formatting - storing a string as 01 rather than just 1 works better for what I'd like to do^*/
temp.Data = temp.ID + temp.Name + temp.Turns.../*Through to Size*/;
}
int Counter;
string[] NameOptions = {"Jim", "Kim",..};
public class Stored
{
public string ID;
public string Name;
public string Turns;
public string Health;
public string Size;
public string Data;
}
List<Stored> AllItems = new List<Stored>();

void GenerateStored(int number)
{
if(Counter < 99)
{
for (int i = 0; i < number; i++;)
{
Stored temp = new Stored() {ID = Counter.ToString(), Name = Random.Range(0, NameOptions.Length).ToString(),.../*etc. for everything except 'Data'*/}
StoredDataSet(temp);

AllItems.Add(temp)

}
}
}

void StoredDataSet(Stored l)
{
Stored temp = l;
if(Convert.ToInt16(temp.ID) < 10)
{
temp.ID = '0' + temp.ID;
}
if(Convert.ToInt16(temp.Name) < 10)
{
temp.Name = '0' + temp.Name;
}
...
/*^This all is what I'd like to streamline formatting - storing a string as 01 rather than just 1 works better for what I'd like to do^*/
temp.Data = temp.ID + temp.Name + temp.Turns.../*Through to Size*/;
}
48 replies
CC#
Created by Nurglini on 10/25/2023 in #help
Is there a 'foreach' equivalent for parts of a class?
For reference, how do I format my message to appear like this?
48 replies
CC#
Created by Nurglini on 10/25/2023 in #help
Is there a 'foreach' equivalent for parts of a class?
I'm away from my computer at the moment, I can later though
48 replies
CC#
Created by Nurglini on 10/25/2023 in #help
Is there a 'foreach' equivalent for parts of a class?
I'm afraid I don't understand how it would be damning? My efforts at the moment are basically equivalent to going through and doing a .ToUpper() for each one if it's a certain length
48 replies
CC#
Created by Nurglini on 10/25/2023 in #help
Is there a 'foreach' equivalent for parts of a class?
Yes, rather than manually changing them one at a time (having to repeat an if statement each time), I essentially just write it the once.
48 replies