ynpMOOSE

ExtDb2 commands not executing

5 posts in this topic

I've added a class to my mission PBO, adding a menu option to the Office Trader. The menu option does appear in-game and the custom SQF is successfully called (verified with hint messages).

class OfficeTrader
    {
        targetType = 2;
        target = "Exile_Trader_Office";

        class Actions 
        {
            class CreateChangeWebPIN: ExileAbstractAction
            {
                title     = "Create/Change Web Integration PIN";
                condition = "true";
                action    = "_this call webPINIntegration";
            };

        };
    };

The custom SQF is in the mission PBO and is compiled in the init.SQF:

webPINIntegration = Compile PreprocessFile ("custom\webPinIntegration.sqf");

I've added custom SQL to the Exile.ini, created a table in the Exile db and tested the SQL command syntax in MySQL Workbench.

[createAccountWebPIN]
SQL1_1 = INSERT INTO web_pin SET web_pin = ?, account_uid = ?
Number Of Inputs = 2
SQL1_INPUTS = 1,2

However, when I try to call the SQL from my custom SQL, nothing happens. I tried the debug version of extdb2.dll and it doesn't log anything about this SQL attempt. Again, I verified with hints that the playerUid and webPin are generating proper values.

 private ["_playerUid","_webPIN"];

//Get PlayerUID
_playerUid = getPlayerUID player; 

//Generate random 6-digit PIN number\
_webPIN    = floor(random 900000) + 100000;

format ["createAccountWebPIN:%1:%2", _webPIN, _playerUid] call ExileServer_system_database_query_insertSingle;

@Torndeco , or anyone else, have any ideas why this isn't executing?

 

Thanks,
Moose

Edited by ynpMOOSE

Share this post


Link to post
Share on other sites

If you are using the debug version of extDB2, you will see log entries for every callExtension.
So that means 
 

format ["createAccountWebPIN:%1:%2", _webPIN, _playerUid] call ExileServer_system_database_query_insertSingle;

Is never ran on the server
So you screwed up your sqf code somewhere, you really should be adding diag_log statements (not hints) & verifying the code is actually ran on the server.

Share this post


Link to post
Share on other sites
Advertisement

OK, I'm still learning. Thanks for the diag_log tip @Torndeco. I can now see using diag_log that the variables are both set correctly, but see these errors below in the server log. My guess is that I'm executing client side, but need to execute server side. Trying to figure out how to do this, but it's not coming to me easily.

14:42:38 Error in expression <ebPIN:%1:%2", _webPIN, _playerUid] call ExileServer_system_database_query_insert>
14:42:38   Error position: <ExileServer_system_database_query_insert>
14:42:38   Error Undefined variable in expression: exileserver_system_database_query_insertsingle

Edited by ynpMOOSE

Share this post


Link to post
Share on other sites
5 hours ago, yellow|avdieking said:

you can't execute it from a client it has to be server side

Yup, this was definitely the problem. I've got it working now. Sending to server via ExileClient_system_network_send and a modified ExileServer_system_network_dispatchIncomingMessage.

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.