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

Woo, DruinkScript

Sign in to follow this  
Evil Steve


I played about with GameMonkey script, and then discovered that it kept crashing (deleting an invalid pointer for some reason), so I gave up with it and decided to make my own scripting language; DruinkScript.
It's very simple and assembly like. Here's my test script:

; for(int a=0; a<10; ++a) Test();
mov a, 0 ; a=0
mov b, 10 ; b=10
label omgwtflol2
call Test
inc a
cmp a, b ; if(a < 10)
jl omgwtflol2 ; goto omgwtflol2;

; for(int a=0; a<10; ++a) Test();
mov a, 0 ; a=0
label omgwtflol2
call Test
inc a
cmp a, b ; if(a < 10)
jl omgwtflol2 ; goto omgwtflol2;

All working [smile] The main reason I did this is so I know exactly what's going on internally when I call scripts, and so I can say I've written a scripting language :P

Anyway, I'm knackered, and it's 4:40am here, so I'm going to leave this as a short entry.
Sign in to follow this  


Recommended Comments

Oh yeah, I don't disagree that it's ugly [smile] But it was fast to write, very fast to run, and very difficult to crash. So it suits my needs perfectly.

And here's some sample code:

bool Callback(IDruinkScriptStack* pStack, IDruinkScriptVM* pVM, void* pContext)
// Check the top of the stack is a string
if(pStack->GetTop()->type != IDruinkScriptStack::Type_String)
pVM->SetError("Function() expects a string argument");
return false;

return true;

const char* szScript =
"push \"Hello World! \n"
"push 42\n"
"add\n" // Composes "Hello World! 42" on the stack
"push \"\n"
"call Function\n";

IDruinkScriptVM* pVM = CreateDruinkScriptVM();

// The VM ensures that the stack has at least the 3rd parameter
// elements on it, so you don't need to check in the function.

IDruinkScript* pScript =
if(!pScript) return false;


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.

GameDev.net 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!