Jump to content

Notepad++ autocomplete for DCSworld Project


Wrench

Recommended Posts

Hey guys.

I've started a project making an autocomplete file for DCS world and Notepad++.

It needs a plugin (which is useful in its own right) called Progress Programmers Pal (3P), which, among other things, Makes the autocomplete feature much better.

 

The idea is that you can start typing any part of the name of the function you intend to use, and it'll guess the rest.

I have it set up to then provide the arguments as found on the Wiki.

I've also added some tricks to get to some faster giver the non-linear ability of 3P.

 

For example, to write the line

 

local pos1 = Unit.getByName(string_name):getPosition().p

 

L [enter] gets you local, then you type the "pos1 = " manually, then the keypresses are

U[ent].byn[enter]getpp

 

Another one is for writing event handlers.

It's a little more complicated, but you start typing the type of event handler you want (for example, S_EVENT_DEAD.)

 

I'll type something like "evd" and it'll guess S_EVENT_DEAD. I have the S_EVENT_DEAD table saved, so you can see the information that table gives you.

So you press enter and get

 

--S_EVENT_DEAD = {  id = 8,  time = Time,  initiator = Unit,}

 

This is just there to tell you what information you can get from the event, and the specific name DCS uses for it. Note that it comments out this line, as DCS doesn't like you trying to define Events.

Then start typing onevent and you'll get

 

function Func_name:onEvent(event)
if event.id == Event_Name then
	
end
end

 

Substitute in the name you want for the function, (the name of the table you got from the previous step) and the code you want it to run. This would include getting the event.initiator you can see in the S_EVENT_DEAD table you got earlier. For example, we'll have a trigger.action.outText to tell us who dies.

 

press "outex" and it'll guess

 

trigger.action.outText(string_text, number_displayTime , boolean_clearview)

 

Sub in the values you want for that, and you're done.

 

It'd look like this:

 

function Wrench_death_text:onEvent(event)
if event.id == S_EVENT_DEAD then
	trigger.action.outText(tostring(Unit.getName(event.initiator)), 10 , false)
end
end

Note that I added a tostring and getname, which I didn't feel I needed to outline in detail if you've followed me thus far.

 

 

Videos are always better:

 

 

Let me know if this is something you'd be interested in, and I'll continue adding commands to it.

 

I'll attach my quick demo here, but its far from feature-complete.

This goes in notepad++ installation directory>plugins>APIs

 

Full disclosure, The forum won't let me post XML files, so I'm using dropbox.

https://www.dropbox.com/s/q0e0bvv2x8o41x6/lua.xml?dl=0

Dropbox will also let you view the code before you download the file.


Edited by Wrench
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...