Jump to content

Recommended Posts

I'm hoping someone can shed some light on this before I throw my keyboard out the window.  I'm modifying a script that saves data using:

profileNamespace setVariable

I'm going to use the database to store and retrieve data instead.  I can't get the script to communicate with the DB though.  I've never had an issue doing this so I assume that I'm missing something simple.  For now I'm just using the code snippet needed to test the connections, running them from the infiStar admin console.  I've tried using the [] span and omitting it, populating the variable with simple data instead of extrapolated data, and many other things to simplify and get down to the root.  My results in the InfoTitleAndText used for testing the variable show with either nothing, "ANY", or "scalar NaN", depending on what type of data type I'm using in the DB.  I've tried many forms of numerical formats as well as text formats. I have a value of 0.11 in the DB column so that it's not empty.

 

Code:
 

Spoiler

[] spawn
{
_resistance = format ["getEVR_Res:%1", _player getVariable["ExileOwnerUID",""]] call ExileServer_system_database_query_selectSingle;
_newResistanceLevel = (_resistance + 0.01);
["InfoTitleAndText", ["Resistance", format ["Your new resistance is %1",_newResistanceLevel]]] call ExileClient_gui_toaster_addTemplateToast;
};

 

 

Spoiler

[] spawn
{
_resistance = .07;
_newResistanceLevel = (_resistance + 0.01);
format["updateEVR_Res:%1:%2", _newResistanceLevel, _player getVariable["ExileOwnerUID",""]] call ExileServer_system_database_query_fireAndForget;
["InfoTitleAndText", ["Resistance", format["Your new resistance is %1", _newResistanceLevel]]] call ExileClient_gui_toaster_addTemplateToast;
};

 


My modified account table (ExtDB3):
 

Spoiler

CREATE TABLE `account` (
	`uid` VARCHAR(32) NOT NULL COLLATE 'utf8_general_ci',
	`clan_id` INT(11) UNSIGNED NULL DEFAULT NULL,
	`name` VARCHAR(64) NOT NULL COLLATE 'utf8_general_ci',
	`score` INT(50) NOT NULL DEFAULT '0',
	`kills` INT(11) UNSIGNED NOT NULL DEFAULT '0',
	`zedkills` INT(11) UNSIGNED NOT NULL DEFAULT '0',
	`deaths` INT(11) UNSIGNED NOT NULL DEFAULT '0',
	`locker` INT(50) NOT NULL DEFAULT '0',
	`first_connect_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`last_connect_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`last_disconnect_at` DATETIME NULL DEFAULT NULL,
	`total_connections` INT(11) UNSIGNED NOT NULL DEFAULT '1',
	`owns_virtualgarage` VARCHAR(5) NOT NULL DEFAULT 'false' COLLATE 'utf8_general_ci',
	`reborn_evr_res` DECIMAL(3,2) NOT NULL DEFAULT '0.00',
	PRIMARY KEY (`uid`) USING BTREE,
	INDEX `clan_id` (`clan_id`) USING BTREE,
	CONSTRAINT `account_ibfk_1` FOREIGN KEY (`clan_id`) REFERENCES `exile_esseker`.`clan` (`id`) ON UPDATE RESTRICT ON DELETE SET NULL
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB
;

 

 

My exile.ini entries:
 

Spoiler

[updateEVR_Res]
SQL1_1 = UPDATE account SET reborn_evr_res = ? WHERE uid = ?
SQL1_INPUTS = 1,2

[getEVR_Res]
SQL1_1 = SELECT reborn_evr_res FROM account WHERE uid = ?
SQL1_INPUTS = 1
OUTPUT = 1

 

 

 

 

Share this post


Link to post
Share on other sites

×