Sign in to follow this  
FireStorm

How interact with exile DataBase

36 posts in this topic

Hi, I would like to make sure that when a player enters a zone it changes a value in a column ("testlevel") in the "player" table. 

So I started by adding the column in question in the database with this: 

ALTER TABLE account ADD testlevel int(11) DEFAULT '0'

 

I think it worked. But I am stuck at this step. Some help ?

Thx

Share this post


Link to post
Share on other sites
Advertisement

Oh, it's not for a specific reason I just want to interact with a column of the database from the mission. Now that you say it I think of a system of "easter egg" for example. The player discovers an area or picks up something and boom this is added to the database.

Share this post


Link to post
Share on other sites

Look at these few files to get an understanding of how it's done for player table.

 

ExileServer_object_player_createBambi.sqf (Creating bambi so your variable will need to be set here)

ExileServer_object_player_database_load.sqf (Loads info from DB)

ExileServer_object_player_database_update.sqf (Updated DB info)

ExileServer_object_player_network_savePlayerRequest.sqf (might be necessary for your thing)

Exile.ini

 

I mean most load/create/update files will contain some knowledge for you.

Share this post


Link to post
Share on other sites
20 hours ago, FireStorm said:

Hi, I would like to make sure that when a player enters a zone it changes a value in a column ("testlevel") in the "player" table. 

So I started by adding the column in question in the database with this: 


ALTER TABLE account ADD testlevel int(11) DEFAULT '0'

 

I think it worked. But I am stuck at this step. Some help ?

Thx

This is not gonna change a value in a column, it adds the column.So basically, this would work 1 time.

You have to create the column int your DB with:

ALTER TABLE account ADD testlevel int(11) DEFAULT '0'

Once you did that, this is your call in exile.ini:

[testlevel]
SQL1_1 = UPDATE account SET testlevel = testlevel + 1

 

For script, if entering the zone then:

format["testlevel"] call ExileServer_system_database_query_fireAndForget;

 

Edited by WURSTKETTE

Share this post


Link to post
Share on other sites
12 hours ago, WURSTKETTE said:

This is not gonna change a value in a column, it adds the column.So basically, this would work 1 time.

You have to create the column int your DB with:


ALTER TABLE account ADD testlevel int(11) DEFAULT '0'

Once you did that, this is your call in exile.ini:


[testlevel]
SQL1_1 = UPDATE account SET testlevel = testlevel + 1

 

For script, if entering the zone then:


format["testlevel"] call ExileServer_system_database_query_fireAndForget;

 

Thx <3
It works !
And how could I do the opposite? For example when the player enters the area the script will get the value in the table and display it on the screen via "hint" for example?

I tried to replace:

call ExileServer_system_database_query_fireAndForget;

with something else like:

call ExileServer_system_database_query_selectSingle;

But without succes...

Thx for help :D

Share this post


Link to post
Share on other sites
2 hours ago, FireStorm said:

Thx <3
It works !
And how could I do the opposite? For example when the player enters the area the script will get the value in the table and display it on the screen via "hint" for example?

I tried to replace:


call ExileServer_system_database_query_fireAndForget;

with something else like:


call ExileServer_system_database_query_selectSingle;

But without succes...

Thx for help :D

It sounds like you're trying to add 1 and then remove 1 from the database from the new column. You would still use  ExileServer_system_database_query_fireAndForget but you would need more code to tell the database what you want it to do.

Share this post


Link to post
Share on other sites
[testlevel1]
SQL1_1 = SELECT testlevel FROM account
Number of Inputs = 0
OUTPUT = 1
_testlevel = "testlevel1" call ExileServer_system_database_query_selectFull;
["SuccessTitleAndText", ["Success!", format["Zone has been entered '%1' times so far. ", _testlevel]]] call ExileClient_gui_toaster_addTemplateToast;

 

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.