motd

Forum for scripters of NWN material and third party applications.
Post Reply
terryrayc
World Leader: Arkaz
Posts: 571
Joined: Mon Nov 24, 2003 10:34 pm
Location: Florida
Contact:

motd

Post by terryrayc » 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

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';
then change the send_motd script

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);
}
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.
Visit the Arkaz [url=http://www.arkaz.com/wiki]Wiki[/url]
Or the Arkaz [url=http://www.arkaz.com]Website[/url]

Sindol
Ambassador: Catara
Posts: 78
Joined: Tue Nov 25, 2003 3:33 am
Location: Avlis & Catara

Post by Sindol » Fri Nov 11, 2005 4:09 am

Catara currently uses a welcome word / message of the day that is dropped into the in game journal. It cannot be altered without actually going into the toolset and changing the text at this time, but when we discover the need for that it shouldn't be hard to make it DBase oriented, with a webtool so people can chance it from our website DM interface (as opposed to an in-game DM scribe, although that option is of course just as valid to tack it onto).
So much fun,
yet so little time to enjoy it.
- Sindol

Post Reply