Startup Lolicode Code

I’m trying to use this new startup lolicode feature, but when using your example code I get this error: [IDLE] NullReferenceException: Object reference not set to an instance of an object.

ACQUIRELOCK globals
TRY
// Check if global token already set or if we need to refresh it
var globalsDict = ((IDictionary<String, object>)globals);
if (!globalsDict.ContainsKey("Token") || globals.NeedsRefresh)
{
  // If not set or needs refresh, grab it
  await GetToken();
  globals.NeedsRefresh = false; // No need to refresh anymore
}
CATCH
throw;
FINALLY
RELEASELOCK globals
END

async Task GetToken()
{

// --- START EDITING HERE
// Put the blocks to grab the token here, for example

// Http Request block
// Keycheck block to see if the token is in the page, if not then just go to BAN
// Parse block to parse the token from data.SOURCE to a variable called Token
// --- STOP EDITING HERE

globals.Token = "xxd";
LOG "Saved globals.Token"
}

This code you are referencing to is meant to be put in the normal LoliCode section. Even more so since you’re refreshing the token mid-config, you just cannot do that from the startup code. The startup code is meant to, for example, get the token the first time (to avoid using weird lock tricks), it does not have the ability to run alongside your config to refresh the token.

Thanks fixed :slight_smile: . Keep the great job Ruri