C
C#13mo ago
Gamer On

✅ Google Sheets API Randomized value

Im trying to use the value of a string to assign a value to an int, however whatever I have done doesnt work and it assumes the default value 0, can someone please help me
static readonly string[] Scopes = { SheetsService.Scope.Spreadsheets };
static readonly string ApplicationName = "Database";
static readonly string SpreadsheetID = "1jDzM7s1xYTREZnCEL3U-BEeEPY6vQI3TR0D8fItX_-Y";
static readonly string sheet = "Attacks";
public static int rowCount;
public static string[] moveList;

public static void PlayerMoveLookup(Player player, string attack)
{
var range = $"{sheet}!A1:F10";
var request = Program.service.Spreadsheets.Values.Get(SpreadsheetID, range);

var response = request.Execute();
var values = response.Values;

if (values != null && values.Count > 0)
{
foreach (var row in values)
{
if (row[0].Equals(attack))
{
player.attack1.dmg = (int)row[1];

}
}
}
}
static readonly string[] Scopes = { SheetsService.Scope.Spreadsheets };
static readonly string ApplicationName = "Database";
static readonly string SpreadsheetID = "1jDzM7s1xYTREZnCEL3U-BEeEPY6vQI3TR0D8fItX_-Y";
static readonly string sheet = "Attacks";
public static int rowCount;
public static string[] moveList;

public static void PlayerMoveLookup(Player player, string attack)
{
var range = $"{sheet}!A1:F10";
var request = Program.service.Spreadsheets.Values.Get(SpreadsheetID, range);

var response = request.Execute();
var values = response.Values;

if (values != null && values.Count > 0)
{
foreach (var row in values)
{
if (row[0].Equals(attack))
{
player.attack1.dmg = (int)row[1];

}
}
}
}
7 Replies
cap5lut
cap5lut13mo ago
did u try debugging it yet to check where its actually going wrong?
Gamer On
Gamer On13mo ago
Yeah I figured out the problem 1. I was converting it into an int the wrong way because I thought it was a different Item type 2.The place where i called it had the parameters interchanged So do I keep this thread open for the next time I need help or is there a way to resolve it?
cap5lut
cap5lut13mo ago
this way u can $close it:
MODiX
MODiX13mo ago
Use the /close command to mark a forum thread as answered
Gamer On
Gamer On13mo ago
ok but i actually have another problem which is the reason for the title not making sense
cap5lut
cap5lut13mo ago
then simply open another thread one thread per issue ;p
Gamer On
Gamer On13mo ago
k, i think ill try troubleshooting it a bit more tho thx uh there are three different /close
Want results from more Discord servers?
Add your server
More Posts