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

Yay, a scripted MUD

Sign in to follow this  
Evil Steve


My MUD now has simple scripting using DruinkScript [smile] I ended up writing my own string class, since I want a nice lightweight one that can actually free memory when I tell it to, which std::string doesn't (calling std::string::clear() doesn't free memory). The reason is, that I use memory pools in DruinkScript, and if the memory isn't freed, then the pools eventually overflow (It's hard to explain, just take my word for this).
So all strings inside IDruinkScript::Run() are lightning fast.

I've added a few more opcodes to DruinkScript, and I've got a test script working. Here's the list of supported opcodes in DruinkScript now:
push, pop, mov, add, sub, mult, div, pow, sqrt, inc, dec, call, label, jmp, je, jne, jl, jle, jg, jge, cmp, return, rand.
And here's my test script, linked to the OnExit event, which is fired whenever a user tries to exit a room:

; TestScriptExit.ds
; Denies the user from exiting a room 50% of the time

rand 0, 1
pop a
cmp a, 0
je Deny
return 1
label Deny
push "Computer says no.\n
call Send
return 0

Yay! Now I need to bind some more functions, and implement some more commands, and actions. Then I want to get spells and NPCs up and running, then we can have some combat.
Sign in to follow this  


Recommended Comments

There are no comments to display.

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, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!