Looping database messages for Epoch

spaces.are.evil

New Member
I have been attempting to get looping messages from the database on my epoch server. I have run into a snag and cannot figure this out. Hopefully with the help of the community we can get this figured out and working on the Epoch servers.

First and foremost, we need a table in the database to store our messages, as this does not come with epoch. I am hosted with Dayz.st and created this table through phpmyadmin the first time. I was in the dayz.st IRC chat and someone linked a pastebin of a CREATE TABLE sql statement for the message. I slightly modified it (removed foreign key relations) so that it will insert into an Epoch database. Here is the statement:

Code:
CREATE TABLE IF NOT EXISTS `message` (
  `id` smallint(6) NOT NULL AUTO_INCREMENT,
  `payload` varchar(1024) NOT NULL,
  `loop_interval` int(10) unsigned NOT NULL DEFAULT '0',
  `start_delay` int(10) unsigned NOT NULL DEFAULT '30',
  `instance_id` bigint(20) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;

This should create the message table in the database. Of course you will need to add a message to the database. This is a copy from the dayz.st wiki on the fields when inserting values

ID - This is sequential, start with the number 1 (will auto-increment if left blank)
PAYLOAD - the actual message you want displayed
LOOP_INTERVAL - how many SECONDS before this message displays again
START_DELAY - how many SECONDS before this message starts the first display
INSTANCE_ID - select your instance ID, do NOT leave it null

Next I tried using the dayz.st wiki page on looping messages through database, which required modification to the sever_cleanup.fsm and server_monitor.sqf files.

Here is a link to 2 different versions, both of which seem to be the same. The instructions for taviana are more separated than the dayz.st wiki, but i tried both ways.

http://dayz.st/w/Loop_Messages_from_DB
http://opendayz.net/threads/taviana-2-0-looping-database-messages-tutorial.11177/

The problem that I get is once the server is up and running, no messages come through and the arma2OAserver.rpt file generates an error:

Code:
23:17:09 Error in expression <compile format ["%1", _data];
_status = _result select 0;
 
msgList = [];
_msgCou>
23:17:09  Error position: <_result select 0;
 
msgList = [];
_msgCou>
23:17:09  Error Undefined variable in expression: _result
23:17:09 File z\addons\dayz_server\system\server_monitor.sqf, line 225

This error is generated no matter what version I use for adding looping messages, and I cannot figure out for the life of me why it is happening.

The part of code that is bugging on is this:

Code:
_key = format["CHILD:999:select m.payload, m.loop_interval, m.start_delay from message m where m.instance_id = ?:[%1]:", dayZ_instance];
_data = "HiveEXT" callExtension _key;
 
diag_log("SERVER: Fetching messages...");
 
//Process result
_result = call compile format ["%1", _data];
_status = _result select 0;

To me, it seems like the query result is empty even with the message table populated. The name of the tables match, and so do the columns.

Anyone have a clue on this, because I am lost and would really like to see this functionality brought to Epoch servers.
 
You mentioned that you had to modify to the sever_cleanup.fsm and server_monitor.sqf files, but did you make sure you modified the init.sqf too? Don't forget you still need to chance "enableradio = false " to
//enableRadio false;
 
The enableRadio false doesn't have an effect on this, nor does the init.sqf (as I would not have an error in my server_monitor.sqf file populated in the RPT file). I have double checked to make sure and nothing needed changing. The problem is the query result and parsing through the result.
I believe it is specifically this line:

Code:
_result = call compile format ["%1", _data];

I think it is this line of code because of the error message saying that _result is undefined, which means the query that was ran on the database did not return anything, or I am asking for the wrong information but I have no clue how to test this and see exactly what is being returned by the query.

If I run the query set in the _key variable through phpmyadmin it returns the message, so I know there is no issue there.
 
After looking through my HiveExt.log, I noticed near the top of the file one of the lines read

Code:
2013-07-01 23:12:54 HiveExt: [Error] Invalid method id: 999

Method 999 is used when setting up the _key variable that is sent to the hive.

Code:
_key = format["CHILD:999:select m.payload, m.loop_interval, m.start_delay from message m where m.instance_id = ?:[%1]:", dayZ_instance];

In the tutorials for server messages through the database, they state to use Method 999 for the key, but apparently the Epoch mod does not support this.

What other methods can I use to execute a sql query that will return a result?
 
Back
Top