Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views


Sign in to follow this  
Evil Steve


Back in Edinburgh tonight for a piss-up on Saturday night, and since I have no TV in my room (It's in Glasgow), and this PC (my server) is useless for most things, I may as well post here.

Not much to report really, I spent an hour today (my lunch break) adjusting the code for TEH MUD slightly. I added code to parse user input, which is now nice and simple thanks to my abstraction from the platform specific mess. I'm not going to post more huge chunks of code, but I'll post this bit, which shows a practical use of the scripting:

bool GConnection::Tick()
// See if the client is connected
return false;

// Do main tick
case STATE_New:
// New user, send login prompt
EScriptCall::SP pCall = EScriptMgr::Get().Call(L"SendLoginPrompt");
return false;
m_eState = STATE_ReadUsername;

// Snip...

And the contend of login.script:

-- Login.script - Functions to handle user login

function SendLoginPrompt(user)

-- TODO: Handle IP bans

"Please enter your username: ");

Everything in caps is a global set by the code. I could stick it in a [Lua] script, but since these aren't going to change, and since they'll be referenced from all sorts of scripts, I'm just as well to register them code-side.

If anyone is wondering why I use .script as an extension instead of .lua, it's because the scripting code is abstracted away by the engine. All the game code knows (and should know) is that it's dealing with "A script". The only script that the game code actually loads directly is actoexec.script (Which will bew renamed to boot.script soon), and that sctript loads all the others. I could have all the othre scripts named .lua, but I'm just as easy to call them all .script for constancy.

I have 3 TODO's currently in my code (Although there's still loads to do):
  • Handle telnet negotiation - Easy, I have code for this somewhere I did for another MUD
  • Handle idle timeouts for various user states - Will be done by the script, users at the login prompt will time out after 30 seconds or so with no valid input
  • Handle flooding - Also done by the script
    So on my mental code list, I have:
  • Handle telnet and TA2 protocols (If you don't know, don't ask). Scripts should read / write in the most advanced format, the code should then filter the text to the correct protocol
  • Telnet negotiation (see above)
  • Room classes - Containers for items and users, can have 1 or more exits, a description, and so on
  • User profiles - I think this is already done, sort of. User profiles will just be a series of key-value pairs of strings, and scripts will parse this out into numbers, tables, etc
  • Items - Again, mostly a series of key-value pairs. Need an item manager to load the config file containing items, and commands to reload it
  • NPCs. Not much more to say
    There's a fair bit more, but I'm too lazy to think or type any more, so I'm going to bed.

    Someone leave some comments or I'll cry.
  • Sign in to follow this  

    1 Comment

    Recommended Comments

    Don't cry, Steve.

    MUDs are just boring.

    I need some nicer scripting support but I'm too sleepy to read up on your system.

    Share this comment

    Link to comment

    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
    • Advertisement

    Important Information

    By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

    Participate in the game development conversation and more when you create an account on GameDev.net!

    Sign me up!