pppoe252110
pppoe252110
CC#
Created by pppoe252110 on 7/2/2023 in #help
❔ get names of all monitors in unity
nothing interesting. only bad answers like yours
8 replies
CC#
Created by rapid on 5/28/2023 in #help
✅ Changing variables based on player input
do not forget to check if your cell in range of your array
206 replies
CC#
Created by rapid on 5/28/2023 in #help
✅ Changing variables based on player input
Hello! if you're coding tic-tac-toe, it's better to use an array of cells rather than individual variables example:
string[] cells = new string[]{"1","2","3","4","5","6","7","8","9"};
string[] cells = new string[]{"1","2","3","4","5","6","7","8","9"};
then you can do something like this:
if(int.TryParse(Console.ReadLine(), out int cell)
{

Console.WriteLine($"Wow! your cell is {cell} and value in your cell is{cells[cell]}");
}
if(int.TryParse(Console.ReadLine(), out int cell)
{

Console.WriteLine($"Wow! your cell is {cell} and value in your cell is{cells[cell]}");
}
206 replies
CC#
Created by Mekasu0124 on 5/28/2023 in #help
✅ Need Help Passing Code Off To Helper Function
56 replies
CC#
Created by Mekasu0124 on 5/28/2023 in #help
✅ Need Help Passing Code Off To Helper Function
public bool CheckCorrectIndex(int tries, int userInput, List<string> listObject, out string value)
{
if (userInput >= 0 && userInput <= 3)
{
value = listObject[userInput - 1];
return true;
}
else
{
tries--;
InputInvalid(tries);
}
value = null;
return false;
}
public bool CheckCorrectIndex(int tries, int userInput, List<string> listObject, out string value)
{
if (userInput >= 0 && userInput <= 3)
{
value = listObject[userInput - 1];
return true;
}
else
{
tries--;
InputInvalid(tries);
}
value = null;
return false;
}
56 replies
CC#
Created by Mekasu0124 on 5/28/2023 in #help
✅ Need Help Passing Code Off To Helper Function
anyway you can do what you want
56 replies
CC#
Created by Mekasu0124 on 5/28/2023 in #help
✅ Need Help Passing Code Off To Helper Function
than put in your class not in every method. sorry, but it's stupid
56 replies
CC#
Created by Mekasu0124 on 5/28/2023 in #help
✅ Need Help Passing Code Off To Helper Function
56 replies
CC#
Created by Mekasu0124 on 5/28/2023 in #help
✅ Need Help Passing Code Off To Helper Function
56 replies
CC#
Created by Mekasu0124 on 5/28/2023 in #help
✅ Need Help Passing Code Off To Helper Function
public bool CheckCorrectIndex(int tries, int userInput, List<string> listObject, out string value)
{
if (userInput >= 0 && userInput <= 3)
{
value = listObject[userInput - 1];
return true;
}
else
{
tries--;
InputInvalid(tries);
}
return false;
}
public bool CheckCorrectIndex(int tries, int userInput, List<string> listObject, out string value)
{
if (userInput >= 0 && userInput <= 3)
{
value = listObject[userInput - 1];
return true;
}
else
{
tries--;
InputInvalid(tries);
}
return false;
}
56 replies
CC#
Created by Mekasu0124 on 5/28/2023 in #help
✅ Need Help Passing Code Off To Helper Function
what kind of stuff you need to return
56 replies
CC#
Created by Mekasu0124 on 5/28/2023 in #help
✅ Need Help Passing Code Off To Helper Function
so add some code there cus i don't understand what to do
56 replies
CC#
Created by Mekasu0124 on 5/28/2023 in #help
✅ Need Help Passing Code Off To Helper Function
int tries;

public void SelectionScreen()
{
if (int.TryParse(userInput, out var input))
{

}
else
{
tries--;
InputInvalid();
}
}

public void InputInvalid()
{
if (tries > 0)
{
Console.WriteLine($"\nInput Must Be An Integer. Try Again. {tries} Left.");
SelectionScreen(tries);
}
else
{
Console.WriteLine("\nInvalid Input 3 Times. Returning To Welcome Screen.");
Thread.Sleep(2000);
Console.Clear();

Program program = new();
program.WelcomeScreen();
}
}
int tries;

public void SelectionScreen()
{
if (int.TryParse(userInput, out var input))
{

}
else
{
tries--;
InputInvalid();
}
}

public void InputInvalid()
{
if (tries > 0)
{
Console.WriteLine($"\nInput Must Be An Integer. Try Again. {tries} Left.");
SelectionScreen(tries);
}
else
{
Console.WriteLine("\nInvalid Input 3 Times. Returning To Welcome Screen.");
Thread.Sleep(2000);
Console.Clear();

Program program = new();
program.WelcomeScreen();
}
}
56 replies
CC#
Created by Mekasu0124 on 5/28/2023 in #help
✅ Need Help Passing Code Off To Helper Function
so you don't even need to return anything
56 replies
CC#
Created by Mekasu0124 on 5/28/2023 in #help
✅ Need Help Passing Code Off To Helper Function
or just use global variables
56 replies
CC#
Created by Mekasu0124 on 5/28/2023 in #help
✅ Need Help Passing Code Off To Helper Function
bool valueIsInt = CheckInputIsInteger(tries, Console.ReadLine(), out userSelection);
bool valueIsInt = CheckInputIsInteger(tries, Console.ReadLine(), out userSelection);
56 replies
CC#
Created by Mekasu0124 on 5/28/2023 in #help
✅ Need Help Passing Code Off To Helper Function
out userSelection is your value
56 replies
CC#
Created by Mekasu0124 on 5/28/2023 in #help
✅ Need Help Passing Code Off To Helper Function
dude
56 replies
CC#
Created by Mekasu0124 on 5/28/2023 in #help
✅ Need Help Passing Code Off To Helper Function
........
56 replies
CC#
Created by Mekasu0124 on 5/28/2023 in #help
✅ Need Help Passing Code Off To Helper Function
if (CheckInputIsInteger(userInput, out var value))
{
//do stuff with value
}
else
{
//not int
}
if (CheckInputIsInteger(userInput, out var value))
{
//do stuff with value
}
else
{
//not int
}
56 replies