Forum Jump :

Author Message

Posts: 3

Level: Member

Country: br
Location: RS
Age: 28
In-game name: DeWitt

#173567 Posted at 2014-11-29 22:35        
Hi guys, I'm new on scripting, and I'm stuck in a script to get a string from MySQL and put into a variable:

I tried everything, but nothing seems to work...

_db = "armadb";
_query = format ["SELECT uniqueid FROM ppersistent WHERE pid = _uid"];

_checkeduid = "Arma2Net.Unmanaged" callExtension format ["Arma2NETMySQLCommand ['%2', '%1']", _query, _db];

All ok here, Arma2net logs says that a value was got from mysql, and it returns an Array:
All above is ok, no errors. The problem happens next, when i try to remove the brackets using "select" and try to attribute the output to _checkeduid2:

_checkeduid2 = (((call compile format["%1",_checkeduid]) select 0) select 0) select 0;

I'm pretty sure that I'm doing something wrong here, but, not sure. Anyway..
I've tested with "typeName" and now the value is a string, not an array anymore:


But, when I try it:

if (_uid == _checkeduid2) then {player sidechat format ["%1",_variable3]} else {player sidechat format ["%1",_variable4]};

It return's an error:
Error Undefined variable in expression: _checkeuid2

Using diag_log, the variable shows as defined:

diag_log format ["Returned value for checkeduid2 is %1",_checkeduid2];

In .rpt file it works as expected:
"Returned value for checkeduid2 is 31645987316458754"

But I don't understand why it does not work in the condition statement?

So, I read a lot of stuff about Arma2NET and ARMA3 scripting, I've tried a lot of things and nothing works, I'm stuck here for days trying to solve the problem.

Any ideas? Any help would be appreciated. Thank you.

This post was edited by DeWitt (2014-12-01 00:41, ago)

Don't give up... *THUMBS UP*