![]() |
SQlite and Observer Mode
On Classic I have it so that account data is added to an SQLite database on a player's first login, and if they have already logged in it is then updating the existing data.
For example: PHP Code:
PHP Code:
PHP Code:
As far as I can tell this seems to co-inside with Observer Mode. |
Ah, there's your problem. Observer mode.
|
what are the column constraints for each field? There have been issues on UN where null community names have had issues so you might be better off evaluating
if(temp.pl.communityname.length() > 0) instead. You say you have a log what entries are failing so can you post an example of that EDIT: posting your function for Player.getSubcription() and Player.getLoginTime() may help as well, if these are in a class than perhaps this is executing before the player joins the class? Or there is an issue with them joining it at all? |
One example of an error caused by the account not being added to the database:
Quote:
There is also a unique index on pid + num but this isn't the problem. One example of an error caused by the account already existing within the database: Quote:
All of the classes are joined and working before this is executed (otherwise this would be producing a function not found error) |
the issue with the first one seems to be num being 0, I imagine that is already being used in an entry
not really sure what would cause issues with the flag not being set, although I wonder why you take that approach instead of just checking to see if SELECT * FROM tPlayer WHERE account='pl.account' and checking to see if there is actually an existing row. UN has had a similar database for about 2 and a half weeks now that hasn't thrown any errors from trials going in and out of observer mode. The first screenshot has a constraint on account being unique, the 2nd has no constraints on any column http://i.imgur.com/TmJ7r.png http://i.imgur.com/ZwzsJ.png |
Maybe you have communityname set to UNIQUE? Would explain why the person with "guest" as community name didn't work.
|
I'm not sure this will fix your problem, but I'd recommend just doing this instead of using a flag:
PHP Code:
It should get rid of any issues resulting from out-of-sync database/player attributes (e.g. if a player is reset or rolled back). Note that this will change the rowid for the player's entry, but you should never rely on the rowid. If you specify a PRIMARY KEY column, it probably won't change the rowid. |
Quote:
Quote:
It's definitely not the issue with this, it can just as easily happen with values above 0. Quote:
What I believe might be the problem is that I have the query executed after a trigger, and so by the time onPlayerStored occurs observer mode is already preventing the ability to write flags to the player. The reason I have it like this is so not to delay any subsequent processes in the Control-NPC's login event where this SQL function is invoked from. As in: Control-NPC - SQL.playerLoggedIn(); Control-NPC - Someothersystem.playerLoggedIn(); SQL.onSQLCommit(); As for the issue of players somehow not being stored in the database though I have no idea, no errors are occurring at the time of logging on, I'm only noticing these accounts aren't there due to later tasks failing to add. |
Quote:
|
Quote:
Ideally observer mode would be waiting on such possible triggered events within the login process before kicking in (more ideally would just be removed as it's a pain in the arse to players and developers alike). |
Quote:
|
Quote:
|
Quote:
PHP Code:
|
Quote:
|
Quote:
|
Quote:
I suppose I could try something such as: PHP Code:
Edit: Tested and it doesn't so scratch that. |
This issue hasn't been occurring with players logging on for the first time over the last several days so presumably moving the query into the original chain of functions as opposed to a subsequent trigger seems to have fixed it.
|
Quote:
Whenever I've witnessed it happen at the precise moment, it's always appeared within the playerlist as if the trial player logs in, logs out, and then back in again. This last time however I asked the player if they had logged out in the start level or experienced any problem, they claimed they were logged in the entire time and it ran smoothly. |
| All times are GMT +2. The time now is 03:58 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.