motd
Posted: Thu Nov 10, 2005 9:59 am
Not sure how many worlds use it but it's in the base Avlis code.
However the only issue I had was the msg was scripted into the code itself so changing it required editing the script in the toolset.
So I changed it to make it DB driven.
Start by making a new table in the DB
then change the send_motd script
Change the Default msg to what ever you want
That's all. When players log in they will get what ever msg is stored in the table.
Next I'm going to update the scribe so DMs can update the msg IG.
However the only issue I had was the msg was scripted into the code itself so changing it required editing the script in the toolset.
So I changed it to make it DB driven.
Start by making a new table in the DB
Code: Select all
DROP TABLE IF EXISTS `motd`;
CREATE TABLE `motd` (
`Motdtxt` varchar(100) NOT NULL default '',
PRIMARY KEY (`Motdtxt`)
) TYPE=InnoDB COMMENT='Stores the Msg of the Day';
Code: Select all
// Name : send_motd
// Purpose : Send Message of the Day to player
// Author : Terry Carter
// Modified : Nov 8, 2005
#include "aps_include"
#include "datetime2"
#include "calendar_include"
void main()
{
string sSQL = "select Motdtxt "+
"from motd ";
SQLExecDirect(sSQL);
if (SQLFetch() == SQL_SUCCESS)
{
string sMotdtxt = SQLDecodeSpecialChars(SQLGetData(1));
SendMessageToPC(OBJECT_SELF, sMotdtxt);
}
else
{
// Default message
SendMessageToPC(OBJECT_SELF, "Welcome to Arkaz!!");
}
// Construct a "calendar message"
string sCalendar;
struct DateTime dNow = getCurrentDateTime();
sCalendar += "It is";
sCalendar += GetCalendarAttribute(dNow);
sCalendar += GetCalendarWeekDay(dNow) + " ";
sCalendar += GetTimeOfDay(dNow) + " in the ";
sCalendar += GetCalendarSeason(dNow) + " of the year ";
sCalendar += IntToString(dNow.year) + ".";
SendMessageToPC(OBJECT_SELF, sCalendar);
}
That's all. When players log in they will get what ever msg is stored in the table.
Next I'm going to update the scribe so DMs can update the msg IG.