Gamer On
Gamer On
CC#
Created by Gamer On on 7/6/2023 in #help
✅ 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];

}
}
}
}
12 replies