Yeah, i think that is my last resort though because I don't want to kick players off if it is possible to use an alternative method like the one brian posted below (except there's one conflict).
Add an if/else in your loop:
if they are online (use 'attachrid' to check), then use set to update their variable
else if they are offline, use query_sql to modify the variable in SQL.
As you said, modifying their variables in SQL while they are online has no effect.
yes, but the problem is that i'm trying to set a char variable, not an account variable. i think attachrid only works for account id, not char id.
is there a custom script command anyone made so we can attach to char id?