# Scripts like in Quake 3

This topic is 5065 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I've been playing around the idea/implementing some of it of making a parser for a script language, like the one they use for menus in Quake 3. I've come to the stage, where I need to customized scripts, which cannot be predicted at loadtime, like "onAction {script}" or something like that. I could of course just store the script as a string, and then translate it every time it needs it, but that would require too much cpu usage in my opinion (especially runtime in a game with a bunch of controls). I've read the Quake 3 source somewhat through (well most of it), but it doesn't say anything about how they do that (if I've missed something, please let me now). It's hidden behind their syscalls, which is probaly a part of their engine since they're not released with the other files. Anyone who knows a better method than translating the script/string at runtime? Because I've never studied this subject before, so what I have right now is just a simple FileParser class, that can read floats, integers and strings from tokens in a Quake 3 script-style way. Or maybe another script that does the same? But I would like to keep it somewhat simple, because I don't want to create another LUA ;) Any suggestions will be appreciated. Thanks! BTW. here's just a snippet from one of the files in the Quake 3 demo menu (for all who wants to know, the .pk3 is just a large zip file like in Doom 3), so that you can see what I am talking about (action, mouseEnter and mouseExit):
itemDef {
name ctr_other
text "Other"
type 1
textscale .25
group grpControlbutton
style WINDOW_STYLE_FILLED
background "ui/assets/button_back.tga"
rect 180 25 65 20
textalign 1
textalignx 32
textaligny 16
forecolor 1 1 1 1
backcolor .37 .1 .1 1
visible 1
action { hide grpSystem ; show other }
mouseEnter { setitemcolor ctr_other backcolor .1 .37 .1 1 }
mouseExit { setitemcolor ctr_other backcolor .37 .1 .1 1 }
}



##### Share on other sites
Well, I just stumpled upon something I didn't saw before (funny, it's only visible after you post?)
They do apparently translate the script runtime - I found the menuDef_t class on line 232 in cgame\ui_shared.h, if anyone should be interested.

I'll try to design my parser after this method for now, but if anyone has other (maybe better and easier to expand) ideas I'll be glad to hear them.

1. 1
Rutin
33
2. 2
3. 3
4. 4
5. 5

• 9
• 14
• 9
• 9
• 9
• ### Forum Statistics

• Total Topics
633331
• Total Posts
3011394
• ### Who's Online (See full list)

There are no registered users currently online

×