Jump to content
The Dark Mod Forums

<=Doom Script Highlighter=>


KalwinSidpen

Recommended Posts

Hello everyone,

 

This xml file features all the information notepad++ needs to highlight important keywords of the doom engine for scripting, writing up material shaders or defs.

 

 

Change log

[v0.1] supports all TDM doom_events.script events

[v0.2] supports doom_events.script and tdm_events.script events

->added sfx archive for autoinstall

[v0.3] added mrt and def (very basic) file support

->Tel's mrt keywords added

->
mrt files support folding for curly brackets

->fixed comment blocks

 

The language definitions will be updated as I find something to add.

How to set it up:

 

-> browse to %appdata%\notepad++\

-> now you have two options

1.) replace userDefineLang.xml

2.) add the whole <UserLang name="Doom3" ext=""> Block to your existing userDefineLang.xml

-> select Doom3 from the language tab in Notepad++

-> enjoy :)

Download

 

Regards,

 

Kalwin

post-3556-126666875777_thumb.jpg

Edited by KalwinSidpen
  • Like 1
Link to comment
Share on other sites

Youre right, its supposed to be under User-Defined.

I deinstalled and reinstalled Notepad++ (5.6.6). Then tried methode 1. Works just fine.

I suspect your userDefineLang.xml ends up in the wrong folder (eventhoug %appdata% should take you to the right place automaticly).

Since I use win7 the xml should be copied to C:\Users\[your_username]\ AppData\Roaming\Notepad++.

Jugding from your screen shot you use either xp or win98, so the folder should be located elsewhere.

However we can find out.

Do a search for stylers.xml, you should end up in a folder that contains the files: Compare.ini, config.xml, contextMenu.xml, session.xml, shortcuts.xml, stylers.xml and a plugins folder.

Thats the one.

Edited by KalwinSidpen
Link to comment
Share on other sites

So it works then ?

In case it still doesn't I made a couple of screenshots to show what i did to make it work.

After the xml has been pasted/altered Notepad++ must be closed and restarted.

 

I hope this will fix it. If not your last bet would be updating your notepad++, eventhough it's quite obvoius that won't do anything. But you never know.

 

Further, I plan to include some autocompletion functionality for frequently used commands as well as merging the xml with serpentines material file definitions (if he agrees).

 

Regards,

 

Kalwin

post-3556-126641260377_thumb.jpg

Link to comment
Share on other sites

Feel free Kalwin :)

 

Also maybe try improve them, I am no expert when it comes to the user defined languages side of things.

(Also try find which files we need to add, my material def doesnt cover sound shaders and Im sure a few other things. tho they should each have their own def)

Link to comment
Share on other sites

Cool stuff. If you want to make it all-TDM recognizable, you can look inside darkmod/tdm_base01.pk4.

 

I think we made a few changes/additions to doom_events.script. Also take a look in tdm_events.script for plenty of custom TDM scriptevents.

yay seuss crease touss dome in ouss nose tair

Link to comment
Share on other sites

Thanks for the hint, Mortem Desino. Didn't know about tdm_events. Features extacly the commands I have been looking for.

By the way. Updated the definitions.

 

One more thing I will need for autoupdate: what are your top 5 most used scripting commands/ mrt lines?

 

Further, I will try to integrate Serpentines material shader definititions. So, is there any complete command reference for mrt files ?

Regards,

 

Kalwin

Link to comment
Share on other sites

Thanks for the hint, Mortem Desino. Didn't know about tdm_events. Features extacly the commands I have been looking for.

By the way. Updated the definitions.

 

One more thing I will need for autoupdate: what are your top 5 most used scripting commands/ mrt lines?

 

Further, I will try to integrate Serpentines material shader definititions. So, is there any complete command reference for mrt files ?

Regards,

 

Kalwin

 

I have a list of "used" keywords in the material etc shaders in my Parser. I can give you the full source code if you want, or just post excerpts here. AFAIK it wasn't released with TDM v1.0 source, so I might just push it to CPAN:

 

Doom3's parser (if you can call it that) acepts almost anything, you can throw any invalid (and sometimes just syntactic nonsense like things split over several lines etc) at it and it eats it. Sometimes it complains but often enough it doesn't, which makes it very hard to spot typos or other mistakes. So my own parser is much more strict and complains as soon as it sees something which it doesn't know. We use it for instance to parse map and definition files to package stuff for release etc. It has the side effects that we enforce certain things (like '"spawnargname" "keyword"' instead of '"spawnarg" keyword') and catch typos etc.

 

Anyway, here is my code it might not be complete (we discover from time to time legit keywords that we simply didn't use before), but it gets very close:

 

# regexp to match parameters in a particle def

# Example:
#                count                           1
#                material                        textures/particles/smokepuff
#                time                            2.000
#                cycles                          0.000
#                bunching                        0.650
#                distribution            cylinder 2.000 4.000 0.000 0.000
#                direction                       cone "15.000"
#                orientation                     view
#                customPath flies 0.000 0.000 0.000
#                speed                            "4.000"  to "43.000"
#                size                             "7.500"  to "19.000"
#                aspect                           "1.000"
#                rotation                                 "50.000"  to "0.000"
#                angle                           10.000
#                randomDistribution                              0
#                boundsExpansion                         0.000
#                fadeIn                          0.350
#                fadeOut                         0.100
#                fadeIndex                               0.000
#                color                           0.770 0.770 0.770 1.000
#                fadeColor                       0.000 0.000 0.000 1.000
#                offset                          0.000 -2.000 0.000
#                gravity                         -6.000

my $qr_particle = qr/^(
   count|material|time|cycles|bunching|distribution|
   direction|orientation|customPath|speed|size|aspect|
   rotation|angle|randomDistribution|boundsExpansion|
   fadeIn|fadeOut|fadeIndex|color|fadeColor|offset|gravity|
   cubemap|texGen|
   )\s+
   ([\w\.\" \/\\-]+)
   \s*\z           # either only spaces or end of line
   /xi;

 

# regexp to match parameters in an articulatedFigure def
my $qr_af = qr/^(
   (?:body|hinge|universalJoint|fixed|ballAndSocketJoint)\d*
   )\s+
   ("[^"]+")/ix;

 

# regexp to match settings in an articulatedFigure def
my $qr_af_settings = qr/^(
       model|
       skin|
       friction|
       suspendSpeed|
       noMoveTime|
       noMoveTranslation|
       noMoveRotation|
       minMoveTime|
       maxMoveTime|
       totalMass|
       contents|
       clipMask|
       selfCollision
   )\s+
   (.*)/ix;

 

# regexp to match settings in an FX
my $qr_fx = qr/^(
       delay|
       duration|
       light|
       offset|
       model|
       name|
       particle|
       uselight|
       sound|
       launch|
   )\s+
   (.*)/ix;

 

# regexp to match settings in an articulatedFigure hinge/body/joint def
my $qr_af_hinge = qr/^(
       joint|
       mod|
       model|
       origin|
       density|
       friction|
       contents|
       clipMask|
       selfCollision|
   anchor|
   angles|
   limit|
   axis|
   coneLimit|
   pyramidLimit|
   shafts|
       containedJoints
   )\s+
   (.*)/ix;

 

# Example:
# regexp matching material shader texts inside blocks

# Example:
#  Program           heatHaze.vfp
#  vertexParm              0       time * 0 , time * 0 // texture scrolling
#  vertexParm              1       .15         // magnitude of the distortion
#  fragmentProgram                 heatHaze.vfp
#  fragmentMap             0       _currentRender
#  fragmentMap             1       textures/sfx/vp1   // the normal map for distortion

my $qr_shader = qr/^
   (blend|rgb|color|scale|centerScale|alphatest|videoMap|red|green|blue|alpha|translate|
    shear|rotate|scroll|Program|vertexParm|vertexProgram|fragmentProgram|fragmentMap|
    privatePolygonOffset|mirrorRenderMap)\s+
   ([\w, \t\*\+\.\\\/\[\]\(\)-]+)\s*
   /xi;

 

# the various functions that can appear:
my $qr_func = qr/(?:
   heightmap|
   addnormals|
   smoothnormals|
   add|
   scale|
   invertalpha|
   invertcolor|
   makeintensity|
   makealpha)/ix

 

#the various keywords that can appear in material/sound definitions:
my $qr_keywords = qr/(
   DECAL_MACRO|
   ai_no_turn|
   random_cycle_start|
   prevent_idle_override|
   ambientlight|
   blendlight|
   foglight|
   clamp|
   cloth|
   blood|
   cardboard|
   collision|
   discrete|
   glass|
   forceoverlays|
   forceoverlay|
   forceopaque|
   forceshadows|
   flesh|
   ladder|
   liquid|
   # for sounds
   looping|no_dups|omnidirectional|private|unclamped|global|
   # for materials
   colored|maskcolor|maskalpha|forcehighquality|alphaZeroClamp|vertexColor|zeroClamp|linear|screen|distortion|
   # for decals
   polygonoffset|
   metal|
   monsterclip|
   mirror|
   noimpact|
   nofragment|
   noselfshadow|
   noshadows|
   noportalfog|
   nooverlays|
   nonsolid|
   none|
   plastic|
   playerclip|
   ricochet|
   selfshadow|
   stone|
   surftype[0-9]{1,2}|
   translucent|
   twosided|
   unsmoothedtangents|
   water|
   wood
   )/ix;

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

wow, thanks Tels. Exactly what I was looking for :)

 

Somehow the standart implementation for custom languages in notepad++ is a bit weak.So, I thought about writing a custom lexer plugin for smarter highlighting in def files. Unfortunetly C is beyond me, so the highlighter will remain in it's xml bounds.

 

New version by the way.

 

As soon as I have the time, autocompleting will be next

 

Regards,

 

Kalwin

Edited by KalwinSidpen
Link to comment
Share on other sites

  • 5 months later...

Kalwin,

 

This is pretty cool. I tried to do something similiar a year or two ago but could never figure out how to do it with N++.

|=-=------=-=|

happycheeze.deviantart.com

 

Moddb

 

Gamers Outreach, a nonprofit that uses videogames to raise money for chairty.

|=-=------=-=|

Link to comment
Share on other sites

  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
×
×
  • Create New...