Write mafia code prettily!

I didn't see anything like this around, and for some reason the mood struck me to make it. If it's already available then i apologise.

I normally write my mafia code in notepad++ which is generally a nice program for writing code you don't have an IDE for (i find the built in diff especially handy).

Staring at walls of black text started to bore me though, so i made a custom language file for ash to colour things in prettily (warning, my definition of pretty may not match yours).

Edit by Minion, Bale: The following instructions are outdated by the current version of notepad++! Now if you have notepad++ installed you simply click the "import" button on the custom language panel and select the unzipped file. Also, there is a more up-to-date file later in this thread HERE.

If you have notepad++ installed, you can download the attachment and extract it to your appdata, Notepad++ folder.
Location varies but mine was C:\Users\sims\AppData\Roaming\Notepad++ in windows xp i think the equivalent would be "C:\documents and settings\<YOUR USERNAME>\application data\notepad++".
Also note that the AppData folder may be hidden and require you to turn on "view hidden files and folders".
The language file will then automatically be used whenever you open something with a *.ash extension.

The image below shows how it looks in use.

ashexample-1.jpg


If anyone uses this, tell me if you find a command i missed out, or you see ways to make it nicer.
 

Attachments

  • userDefineLang.zip
    2.1 KB · Views: 100
Last edited by a moderator:

Heffed

Member
Various other editor highlighters can be found in this thread I started four years ago. They're obviously going to be a bit out of date, but would give someone a good starting point to updating them for their editor of preference.
 

Sputnik1

Member
Yeah I would like to use this, but I too can't get this to work
I've placed it in the same directory as the .exe file and nothing happens, and I dont seem to have an appdata folder with a notepad++ subdirectory
 
I dont seem to have an appdata folder with a notepad++ subdirectory.

It may not be a direct subdirectory, as in my case you can see it's appdata\roaming\notepad++.

In windows xp i believe the equivalent would be "C:\documents and settings\<YOUR USERNAME>\application data".

Posting as a .zip is a better idea than making people rename the file.

Shame this seems to have been done to death without me noticing it. All my actual code is far too ugly and hacky for general use.
 

fronobulax

Developer
Staff member
Yeah I would like to use this, but I too can't get this to work
I've placed it in the same directory as the .exe file and nothing happens, and I dont seem to have an appdata folder with a notepad++ subdirectory

That could be true, but you might want to confirm that you have allowed Windows to "Show hidden files and folders" since appdata is normally hidden.
 

StDoodle

Minion
Thanks thats what i used to make it. But basic commands like if, else, for etc are not in there. Also i noticed that import wasn't in the list. so probably there are more which i didn't think of.

The list is generated from using the "ashref" command in mafia. It includes normal functions only; not control structures, operators, etc. I would recommend setting up your own parser for said list or grabbing someone else's work, as the wiki page includes extra text (parameters etc) that you don't want in your notepad++ files. The pages listed under "LANGUAGE CONVENTIONS" on the wiki should describe everything else needed; except maybe "notify" and "script" which are both kinda special.

Edit to add;

Since we're discussing notepad++ customization, is there an easy way to set up your preferences for dark backgrounds? I've found that you can't include all of that info in your language-specific files, and some has to be in your general style settings. So it seems I can't have plain txt files as black-on-white but have code & markup in lighter-on-black, for instance, without getting weird junk like line highlighting that doesn't always fit. Am I missing something?
 
Last edited:

heeheehee

Developer
Staff member
Oh, and, uh, note that all instances of is_numeric should be replaced with is_integer (I changed this in the wiki pages as well as in my own version of ash.php, but the wiki's version of ash.php hasn't been updated yet). Mafia change that affects people running newer builds.
 

Winterbay

Active member
I use it to help with my horrible spelling of mafia-funcitons as well. If they don't turn blue and I'm trying to write a standard ash-function I know I've spelled it wrong...
 

Bale

Minion
I use it to help with my horrible spelling of mafia-funcitons as well. If they don't turn blue and I'm trying to write a standard ash-function I know I've spelled it wrong...

The same here. It helps me when I confuse put_shop() with shop_put()
 
Top