A script engine written in QuakeC - Printable Version +- Xonotic Forums (https://forums.xonotic.org) +-- Forum: Creating & Contributing (https://forums.xonotic.org/forumdisplay.php?fid=10) +--- Forum: Xonotic - Development (https://forums.xonotic.org/forumdisplay.php?fid=12) +--- Thread: A script engine written in QuakeC (/showthread.php?tid=5121) |
A script engine written in QuakeC - Melanosuchus - 10-11-2014 Yesterday I thought it would be fun to make a script interpreter in QuakeC and so I did. I'm not sure if this is an interesting concept or just a stupid idea. Anyway, I managed to make it. It currently supports the following features:
The interpreter is accessible via a command which can either run a file or a single line. I've only tested it in server code but it should work fine in menu and client too. Sources: https://github.com/mbasaglia/esk-modpack/tree/script/qcsrc/common/command/script https://github.com/mbasaglia/esk-modpack/blob/script/qcsrc/common/command/script.qc It has a C-like syntax, I guess somewhat similar to JavaScript. Semicolons can be replaced by commas so it's easier to execute snippets from the console. Follows a simple script which gives a basic idea of the syntax: Code: function pluralize(string,number) I made it just for fun, does anyone know if something of this kind can be of any use? RE: A script engine written in QuakeC - Mr. Bougo - 10-11-2014 Looks fun. Blub\0 gave this a thumbs up for the effort on #gmqcc As for usefulness, I don't know. What kind of use do you envision? In servers you may as well code in QC directly. In CSQC, I don't know what clients would use it for really, except maybe rainbow text? RE: A script engine written in QuakeC - Melanosuchus - 10-12-2014 Yeah, rainbow text script! It's much faster and more efficient than the console alias hack (and more readable too ) Code: function hsv(h,s,v) RE: A script engine written in QuakeC - Mr. Bougo - 10-13-2014 Nice, now that's a proper benchmark against existing alternatives It's a bit sad that there is no real use for this. Can this be plugged into menu QC (without entity access then) to be useable by clients on any server? RE: A script engine written in QuakeC - Melanosuchus - 10-13-2014 Yes, it required some minor changes (mostly due to different entity fields in menu) but it works fine. RE: A script engine written in QuakeC - tZork - 10-13-2014 Cool stuff =) And im sure theres possible uses for it, just need to find them! Some ideas: Scripted map events / entities (SP just got a little easier to accomplish) BOT Scripts (we need to get Mirio under better control! ; ) Gamecode that refines itself live (its aliiiiive! :S) RE: A script engine written in QuakeC - Mr. Bougo - 10-13-2014 (10-13-2014, 07:39 AM)tZork Wrote: Cool stuff =) What's SP? I didn't think of mapping, that's a great idea. Perhaps it should be sealed tight to avoid crashes though We already have some nice "programmability" with target_spawn and the range of triggers though, I think the difficulty of handling it makes it more charming. But I'm not a mapper EDIT: Ah, SP is single player. RE: A script engine written in QuakeC - Maddin - 10-13-2014 I remember back the day working on some Jedi Knight Outcast maps (uses modified Quake 3 Engine) which also had a scripting tool allowing for some really crazy stuff. You could essentially do everything with it, control every entity and even create camera sequences/ cutscenes. Thumbs up for your work! I´d like to see it in action, care to make an example video? RE: A script engine written in QuakeC - end user - 10-13-2014 (10-13-2014, 12:44 PM)Maddin Wrote: care to make an example video? OMFG were gonna see technolcolor pony porn RE: A script engine written in QuakeC - Melanosuchus - 10-14-2014 (10-13-2014, 12:44 PM)Maddin Wrote: I´d like to see it in action, care to make an example video? Sure, but do you have an idea about what to show in it? So far all the scripts I've written for it were quick tests to make sure that all the features are working correctly. |