Editor Highlight Codes

Discussion, updates, modifications, etc for the various map editors...
Post Reply
User avatar
Spectre
Private First Class
Private First Class
Posts: 174
Joined: Sat May 24, 2008 2:33 pm

Editor Highlight Codes

Post by Spectre »

Though BZEdit and its counterparts have taken over the BZWorld, a few of us still enjoy hand coding. However, some of us who enjoy it have trouble organizing our maps (what are you looking at?). Therefore, I had an idea: highlighting codes!

Many text editors support language files telling them what to highlight in what color according to a programming language, such as Python, Perl, or C. If this is doable for BZW as part of BZFlag downloads, perhaps bundled with BZFS, please consider it. It would help a lot. If you could give me some reasons why it can or cannot be done, that would be great. Thanks!

-Anathema
Keeping Latin alive in 2766 AUC.
trepan
Dev Wizard
Dev Wizard
Posts: 704
Joined: Fri Feb 21, 2003 7:50 pm

Re: Editor Highlight Codes

Post by trepan »

I created a bzw.jsf syntax file for the joe editor years ago...

Image
User avatar
joevano
General
General
Posts: 1863
Joined: Sat Jun 18, 2005 1:08 pm
Location: South Bend, Indiana, USA

Re: Editor Highlight Codes

Post by joevano »

Anathema wrote:Though BZEdit and its counterparts have taken over the BZWorld, a few of us still enjoy hand coding. However, some of us who enjoy it have trouble organizing our maps (what are you looking at?). Therefore, I had an idea: highlighting codes!

Many text editors support language files telling them what to highlight in what color according to a programming language, such as Python, Perl, or C. If this is doable for BZW as part of BZFlag downloads, perhaps bundled with BZFS, please consider it. It would help a lot. If you could give me some reasons why it can or cannot be done, that would be great. Thanks!

-Anathema
It can and should be done... this is open source software, and the open source spirit is to do it and not wait on someone else. So everyone get cracking on getting bzw syntax highlighting going for your favorite text editor (that supports it) and post them here to share with others.
There is nothing worse than aggressive stupidity. -- Johann Wolfgang von Goethe
"How many legs does a dog have if you call his tail a leg? Four. Calling a tail a leg doesn't make it a leg." -- Abraham Lincoln
User avatar
SkillDude
Private First Class
Private First Class
Posts: 336
Joined: Sun Apr 01, 2007 4:50 pm
Location: United States

Re: Editor Highlight Codes

Post by SkillDude »

Notepad++ fans, here is a custom syntax coloring for this program.

Since Notepad++ is only for windows users, I might be able to write up something for another programming language for another editor, or perhaps integrate it into another program somehow. (What does everyone else use, out of curiosity?) Meanwhile, I have Notepad++ for people that want it.

How to add to Notepad++:

Download:
userDefineLang.zip
(2.77 KiB) Downloaded 536 times
Unzip the userDefineLang.xml file in the zip folder.

Go to Start -- > Run

Type In: explorer %APPDATA%\Notepad++

Place the unzipped userDefineLang.xml file in the folder that opened

The next time you open up a bzw file with Notepad++, there will be syntax coloring. Easier to read and see things :)

Screenshots:
Attachments
syntax.PNG
(36.81 KiB) Not downloaded yet
syntax2.PNG
(48.07 KiB) Not downloaded yet
User avatar
Spazzy McGee
Sergeant Major
Sergeant Major
Posts: 1405
Joined: Mon Mar 21, 2005 4:59 pm
Location: Planet MoFo, Sheffield Division; United Kingdom

Re: Editor Highlight Codes

Post by Spazzy McGee »

I made one that I use with Smultron for mac, made it a couple of years ago.
bzw-smultron.zip
(1.05 KiB) Downloaded 568 times
(Licensed public domain)

Looks like this:

http://img693.imageshack.us/img693/5340 ... ghting.jpg
"Life is what happens to you while you're busy making other plans." - John Lennon
User avatar
Strakowski
Private First Class
Private First Class
Posts: 79
Joined: Wed Jun 24, 2009 4:40 pm
Location: hiding somewhere in Overdoze

Re: Editor Highlight Codes

Post by Strakowski »

Man, thanks for that smultron library, Spazzy, I wish I had had this before! Much better than using textedit. It's too bad that there is no way for smultron to distinguish any more objects than keywords without starting and ending elements, but it still makes BZWs much more navigable as it is.
User avatar
zaphod
Sergeant
Sergeant
Posts: 352
Joined: Sun Jan 23, 2005 3:20 pm
Location: beteigeuze-system
Contact:

Re: Editor Highlight Codes

Post by zaphod »

i agree ::: BIG thanks for sharing Spazzy !!!
whole new experience to look at the map.files :)



.
.
.
.
Image
Yrogirg
Private First Class
Private First Class
Posts: 154
Joined: Sat Oct 27, 2007 7:24 pm

Re: Editor Highlight Codes

Post by Yrogirg »

I wonder if there .lang file for GtkSourceView. Maybe there was bzeditor with it? If so, it could be used for gedit.
Yrogirg
Private First Class
Private First Class
Posts: 154
Joined: Sat Oct 27, 2007 7:24 pm

Re: Editor Highlight Codes

Post by Yrogirg »

Well, I've made .lang file for GtkSourceView. So now you can have syntax highlighting at least in gedit. Gedit is available both for linux and windows.

It also highlights bzfs command line options so could be used to edit configs.

To install the file in Ubuntu copy it into /usr/share/gtksourceview-2.0/language-specs. There is also a way to put it into your home directory if you have no root password, but I don't remember it.

It was hard to make proper highlighting in drawInfo, so there is no.

UPD I've updated the file to include some missing keywords and 2.4 stuff
Attachments
bzflag.lang.zip
(3.39 KiB) Downloaded 526 times
bzwgedit.png
screenshot
(120.19 KiB) Not downloaded yet
Last edited by Yrogirg on Thu Jul 14, 2011 6:19 pm, edited 5 times in total.
tobylane
Private First Class
Private First Class
Posts: 130
Joined: Thu Jan 29, 2009 4:21 pm

Re: Editor Highlight Codes

Post by tobylane »

Spazzy McGee wrote:I made one that I use with Smultron for mac, made it a couple of years ago.
bzw-smultron.zip
(Licensed public domain)

Looks like this:

http://img693.imageshack.us/img693/5340 ... ghting.jpg
Does that work with Fraise?
User avatar
McYukon
Private First Class
Private First Class
Posts: 46
Joined: Mon May 11, 2009 3:12 am
Location: Whitehorse, YT
Contact:

Re: Editor Highlight Codes

Post by McYukon »

Yep,
Right click on the Fraise application and choose "Show Package Contents". Drop the bzw.plist into /Contents/Resources/Syntax\ Definitions. Then open the SyntaxDefinitions.plist under the Syntax Definitions folder and add this code.

Code: Select all

<dict>
	<key>name</key>
	<string>BZW</string>
	<key>file</key>
	<string>bzw</string>
	<key>extensions</key>
	<string>bzw</string>
</dict>
Spazzys .plist for TextWrangler http://cl.ly/6d919157d76a85556426
Copy entire folder to Users>YourUser>Library>Application Support>TextWranger
(Licensed public domain)
MacBook Pro Uni Late 2008, 2.4Ghz, 4GB Ram, Mac OS 10.6.5
User avatar
clarahobbs
Private First Class
Private First Class
Posts: 272
Joined: Thu Jan 10, 2008 1:45 am
Location: The Fourth Dimension

Re: Editor Highlight Codes

Post by clarahobbs »

I have a BZW syntax file for Vim that I've been working on for a while. It's far from complete, but do what you want with it. In other words, this has no copyright or anything.

Code: Select all

syntax case match

syntax match Comment "#.*"

syntax keyword keyword end
syntax keyword keyword world options waterLevel dynamicColor textureMatrix
syntax keyword keyword transform material physics define group mesh meshbox
syntax keyword keyword meshpyr arc cone sphere tetra box pyramid link
syntax keyword keyword teleporter base weapon zone koth face endface

syntax match Number "\<[-]\d\+\([+-]\+\)\=\>"ms=s,me=e
syntax match Number "\<\d\+\([+-]\+\)\=\>"ms=s,me=e
I'm sure it could be done better; I'm new to the whole "vim syntax files" thing.
FKA Ratfink
User avatar
ahs3
Private First Class
Private First Class
Posts: 327
Joined: Sun Mar 04, 2007 8:33 pm
Location: Press '/' to search
Contact:

Re: Editor Highlight Codes

Post by ahs3 »

Yrogirg wrote:Well, I've made .lang file for GtkSourceView. So now you can have syntax highlighting at least in gedit. Gedit is available both for linux and windows.

It also highlights bzfs command line options so could be used to edit configs.

To install the file in Ubuntu copy it into /usr/share/gtksourceview-2.0/language-specs. There is also a way to put it into your home directory if you have no root password, but I don't remember it.

It was hard to make proper highlighting in drawInfo, so there is no.
Very nice thanks Yrogirg
User avatar
optic delusion
Special Forces
Special Forces
Posts: 1052
Joined: Sat Sep 25, 2004 2:29 pm
Location: Planet MoFo
Contact:

Re: Editor Highlight Codes

Post by optic delusion »

Spazzy tried to get me to convert to smultron (mac) awhile ago. I should have. It's good, and open source. I used textwrangler, which has more features, but i never used them.

Now for my feature request. (heh!)
What we need is a macro to add #comment markers to a selected block of text. If it added this "#_ " , we could use the find-replace to remove them, so it would not need a removal macro.
Take a look at my Defender game mode concept.

Thinking is not an automatic process. A man can choose to think or to let his mind stagnate, or he can choose actively to turn against his intelligence, to evade his knowledge, to subvert his reason. If he refuses to think, he courts disaster: he cannot with impunity reject his means of perceiving reality.
Yrogirg
Private First Class
Private First Class
Posts: 154
Joined: Sat Oct 27, 2007 7:24 pm

Re: Editor Highlight Codes

Post by Yrogirg »

Optic Delusion wrote: Now for my feature request. (heh!)
What we need is a macro to add #comment markers to a selected block of text. If it added this "#_ " , we could use the find-replace to remove them, so it would not need a removal macro.
Well, after years of using gedit I've just found out that it has plugins! Moreover there is quite a number of them, featuring rather powerful capabilities. Among the plugins there is one called

Code Comment: Comment or uncomment blocks of code.

It does what you are looking for, though for gedit, but gedit is available for macs too. You can comment and uncomment with Ctrl+M and Ctrl+Shift+M respectivly, or through the "Edit" menu. To work for a particular language it requires an appropriate syntax highlighting file, so in case of bzflag you have to download and install "bzflag.lang".

Ubuntu users can install gedit-plugins from the repositories.

NOTE: I've updated the bzflag.lang file in my previous post.
User avatar
allejo
Breaker of Builds
Breaker of Builds
Posts: 809
Joined: Sun Feb 17, 2008 10:01 pm
Location: /dev/null
Contact:

Re: Editor Highlight Codes

Post by allejo »

I've started a .tmLanguage file just to play around and to learn how to make one. It's far from perfect but any app that supports .tmLanguage files, here you go

https://github.com/allejo/SublimeBZW
User avatar
allejo
Breaker of Builds
Breaker of Builds
Posts: 809
Joined: Sun Feb 17, 2008 10:01 pm
Location: /dev/null
Contact:

Re: Editor Highlight Codes

Post by allejo »

Attachments
bzw.min.js
(4.31 KiB) Downloaded 303 times
bzw.js
(6.79 KiB) Downloaded 300 times
User avatar
allejo
Breaker of Builds
Breaker of Builds
Posts: 809
Joined: Sun Feb 17, 2008 10:01 pm
Location: /dev/null
Contact:

Re: Editor Highlight Codes

Post by allejo »

If you use Sublime Text 3, I've submitted a more up to date syntax definition than my original attempt. If you use ST3, chances are you have Package Control installed so just look for "BZW" and you'll be set.

https://packagecontrol.io/packages/BZW%20Language
Post Reply