Plotscript on Notepad++

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
User avatar
Matokage
Slime Knight
Posts: 275
Joined: Sat May 26, 2012 11:48 pm
Contact:

Plotscript on Notepad++

Post by Matokage »

Well, the title is self explanatory but, is there a way to write plotscript on Notepad++ with support? I tried importing plotscr.xml but it dint work.
"I can't buy food with glory"
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

I assume you're talking just about syntax highlighting?

I don't believe anyone has ever written a HamsterSpeak definition file for Notepad++. IIRC Notepad++ actually has two different ways to define highlighting: standard Scintilla definition files, and a custom format (or is it just a custom editor?). It doesn't look too hard to define using the friendly editor they provide for it.
Last edited by TMC on Tue May 19, 2015 9:41 pm, edited 1 time in total.
User avatar
Matokage
Slime Knight
Posts: 275
Joined: Sat May 26, 2012 11:48 pm
Contact:

Post by Matokage »

Thanks, Tmc. I will Try to define it and IF I succeed, I will publish it here.
"I can't buy food with glory"
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

That would be great.

Are you aware of the HamsterWhisper editor James created? It's based on GtkSourceView, so you can look at the HamsterSpeak definition file for that:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!--

 Author&#58; James Paige <Bob@HamsterRepublic.com>
 Copyright &#40;C&#41; 2010 James Paige <Bob@HamsterRepublic.com>

 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Library General Public
 License as published by the Free Software Foundation; either
 version 2 of the License, or &#40;at your option&#41; any later version.

 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Library General Public License for more details.

 You should have received a copy of the GNU Library General Public
 License along with this library; if not, write to the
 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.

-->
<language id="hamsterspeak" _name="OHRRPGCE Plotscript &#40;HamsterSpeak&#41;" version="2.0" _section="Scripts">
  <metadata>
    <property name="mimetypes">text/x-hamsterspeak</property>
    <property name="globs">*.hss;*.hsi;*.hsd;*.txt</property>
    <property name="line-comment-start">#</property>
  </metadata>

  <styles>
    <style id="comment"             _name="Comment"             map-to="def&#58;comment"/>
    <style id="include"             _name="Include"             map-to="def&#58;preprocessor"/>
    <style id="declare"             _name="Declare"             map-to="def&#58;statement"/>
    <style id="obsolete"            _name="Obsolete"            map-to="def&#58;error"/>
    <style id="flow"                _name="Flow"                map-to="def&#58;statement"/>
    <style id="number"              _name="Number"              map-to="def&#58;number"/>
    <style id="operator"            _name="Operator"            map-to="def&#58;operator"/>
    <style id="string"              _name="string"              map-to="def&#58;string"/>
    <style id="token"               _name="Token"               map-to="def&#58;identifier"/>
  </styles>

  <default-regex-options case-sensitive="false"/>

  <definitions>

    <!-- d is for delimiter -->
    <define-regex id="d">&#40;?=&#91; \t&#93;*&#40;$|&#91;,\&#40;\&#41;&#93;&#41;&#41;</define-regex>

    <context id="comment" style-ref="comment">
      <match>#.*$</match>
    </context>

    <context id="include" style-ref="include">
      <match>^&#91; \t&#93;*include&#91; \t&#93;*,.*$</match>
    </context>

    <context id="declare" style-ref="declare">
      <match>&#40;&#40;plot&#41;?&#91; \t&#93;*script|define&#91; \t&#93;*&#40;constant|function|operator&#41;|&#40;global&#41;?&#91; \t&#93;*variable&#41;\%&#123;d&#125;</match>
    </context>

    <context id="obsolete" style-ref="obsolete">
      <match>&#91;define&#91; \t&#93;*script\%&#123;d&#125;</match>
    </context>

    <context id="flow" style-ref="flow">
      <match>&#40;begin|end|if|then|else|while|do|for|return|exit&#91; \t&#93;+&#40;returning|script&#41;|break|continue|switch|case&#41;\%&#123;d&#125;</match>
    </context>

    <context id="operator" style-ref="operator">
      <match>&#40;\^|&#40;mod|xor|and|or|not&#41;\%&#123;d&#125;|/|\*|&#91;-&#93;&#91;-&#93;|\+=|\+|==|<>|<<|>>|<=|>=|&&|\|\||\^\^|&#58;=|&#91;+&#93;=|&#91;-&#93;=|\$=|\$\+|@&#41;</match>
    </context>

    <context id="number" style-ref="number">
      <match extended="true">
        &#40;?<!&#91;\w\.&#93;&#41;
        &#91;+-&#93;?&#91;0-9&#93;+
        &#40;?!&#91;\w\.&#93;&#41;
      </match>
    </context>

    <context id="string" style-ref="string">
      <match>".*?"</match>
    </context>

    <context id="token" style-ref="token">
      <match>\b&#91;A-Z_&#93;&#91;-A-Z0-9_ \t&#58;&#93;*\b</match>
    </context>
    
    <context id="hamsterspeak">
      <include>
        <context ref="comment"/>
        <context ref="include"/>
        <context ref="operator"/>
        <context ref="number"/>
        <context ref="declare"/>
        <context ref="obsolete"/>
        <context ref="flow"/>
        <context ref="string"/>
        <context ref="token"/>
      </include>
    </context>

  </definitions>

</language>
Last edited by TMC on Fri May 22, 2015 1:02 am, edited 1 time in total.
User avatar
Matokage
Slime Knight
Posts: 275
Joined: Sat May 26, 2012 11:48 pm
Contact:

Post by Matokage »

Yes, i'm aware of it, I even use it for every plotscript I do. I just love the context help when needed.
"I can't buy food with glory"
Post Reply