Notepad++ Maptool Text Editor config file [UPDATE: 5/31/12]

Show off your RPG maps, campaigns, and tokens. Share your gaming experiences and stories under General Discussion and save this forum for things you've created that may help others run their own games. Use the subforums when appropriate.

Moderators: dorpond, trevor, Azhrei, Gamerdude

evilC
Cave Troll
Posts: 49
Joined: Thu Mar 21, 2013 3:29 pm
Location: London, UK

Re: Notepad++ Maptool Text Editor config file [UPDATE: 5/31/

Post by evilC »

I did a bit more fiddling, and put in some error checking and added the save routine.

Changed the hotkeys around too - I ordered it from Notepad's perspective, so F11 is "Load" (From MT to Notepad) and F12 is "Save" From notepad to MT.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

coordmode, mouse, window
loadx = 75
loady = 70
textx = 50
texty = 150
savex = 160
savey = 70
closex = 595
closey = 10

F11::
	WinActivate, MapTool
	send {F9}
	WinWait,ahk_class SunAwtDialog, , 2
	if ErrorLevel{
		return
	}

	MouseMove, %loadx%, %loady%
	Click
	WinWait,ahk_class SunAwtDialog, , 2
	Send {Enter}
	Sleep, 1000
	MouseMove, %textx%, %texty%
	Click
	Send, ^a
	Send, ^c
	MouseMove, %closex%, %closey%
	Click
	
	WinActivate, ahk_class Notepad++
	Send, ^a
	Send, ^v
	return

F12::
	WinActivate, ahk_class Notepad++
	Send, ^a
	Send, ^c
	Send, ^z
	
	WinActivate, MapTool
	send {F9}
	WinWait,ahk_class SunAwtDialog, , 2
	if ErrorLevel{
		return
	}

	MouseMove, %textx%, %texty%
	Click
	Send, ^a
	Send, ^v
	
	MouseMove, %savex%, %savey%
	Click
	Sleep, 500

	MouseMove, %closex%, %closey%
	Click
	
	return


evilC
Cave Troll
Posts: 49
Joined: Thu Mar 21, 2013 3:29 pm
Location: London, UK

Re: Notepad++ Maptool Text Editor config file [UPDATE: 5/31/

Post by evilC »

Thinking about this some more, I had a cracking idea.

How about we set up RPEdit so that when you hit a hotkey it selects one of the lib tokens.

That way, my AHK macro could also select the correct token for editing.
I could even go so far as a lookup - it is possible to detect from AHK the file name that you have open, so if I had a lookup in the macro that said "mylib*.mt is lib:mylib", then if you hit the save macro, it knows you are editing lib:mylib, switches to MT, hits the correct hotkey to select that lib, then does the save routine.
Last edited by evilC on Wed Mar 27, 2013 4:43 pm, edited 1 time in total.

evilC
Cave Troll
Posts: 49
Joined: Thu Mar 21, 2013 3:29 pm
Location: London, UK

Re: Notepad++ Maptool Text Editor config file [UPDATE: 5/31/

Post by evilC »

actually, scrub that, I have just sussed the ultimate way.

Set up ONE hotkey in MT (ideally as part of RPEdit). When you hit this hotkey, a dialog pops up asking you to type which library you want to select into a textbox.

When you hit Load/Save in my macro, it looks at the file name and compares that to a config file which tells it what library you are editing. It then hits the MT hotkey, fills the name of the library in the box, waits a bit for MT to select the token, then initiates the current save / load routine.
Last edited by evilC on Wed Mar 27, 2013 4:44 pm, edited 1 time in total.

evilC
Cave Troll
Posts: 49
Joined: Thu Mar 21, 2013 3:29 pm
Location: London, UK

Re: Notepad++ Maptool Text Editor config file [UPDATE: 5/31/

Post by evilC »

Heh, sorry for the spam, but I started thinking through the possibilities of this a little more.

Autohotkey can read the contents of the clipboard. So when you copy from Notepad to MT, it would be quite possible to have it remove everything between /* and */ - in other words, proper comment support for MT!

Obviously, if you copied back "out" of MT and into notepad, you would lose your comments, but seeing as I am thinking of moving to .mt files in notepad as the "Master" and using a VCS, this should not be a problem.

Useful if nothing else for temporarily commenting out problem blocks of code.

User avatar
aliasmask
RPTools Team
Posts: 9023
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Notepad++ Maptool Text Editor config file [UPDATE: 5/31/

Post by aliasmask »

Hmm, I'm trying to figure if this is any easier than hitting ctrl-alt-c, ctrl-v and clicking save.

As for comments, I thought of doing that within RPEdit. Basically, when you save code to the macros it would pull out all the comments and save them on the token and when exporting, put them back. But if someone modifies the macro code with in MT, there's no guaranty the comments would go back in the right place. The proper solution would be to have the macroscript have comment parsing. In coldfusion, they use <!--- ---> basically adding another dash to html comments.

I think if I tweaked RPEdit a bit to have an input only frame it may work better with autokey, but if autokey can detect submit buttons and read the correct one, that wouldn't be an issue.

My coding process usually goes like this:
write a bunch of code until I get the point I can test something, copy all and paste in to rpedit. Then I either update one macro at a time in notepad++ doing the ctrl-alt-C copy and paste or if I updated a bunch at once, just copy all and paste. I don't use the load option in rpedit very often and when I do, I just load all.

I'm not sure I'm sold that a hotkey makes this process easier.

evilC
Cave Troll
Posts: 49
Joined: Thu Mar 21, 2013 3:29 pm
Location: London, UK

Re: Notepad++ Maptool Text Editor config file [UPDATE: 5/31/

Post by evilC »

So you do not see the point of being able to hit F12 in notepad, and within 2 seconds you have tabbed into maptool, automatically selected the correct library token, opened the RPEdit interface, stripped // and /* */ style comments from your code, pasted it into the RPEdit window, hit Save, closed the RPEdit window and then reselected the token that was previously selected?

User avatar
aliasmask
RPTools Team
Posts: 9023
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Notepad++ Maptool Text Editor config file [UPDATE: 5/31/

Post by aliasmask »

If I had to do that each time, then that could be useful. I usually just do what I mentioned above. I have a frame open for the lib needed. I rarely work on 2 libs at once. I'm also skeptical of "automatically selected the correct library token" and "reselected the token that was previously selected" seeing how current layer and map will be an issue for this. I'm not trying to put your idea down. I just don't think it's something I'm interested in doing, but if you can get it to work to your satisfaction, then I'll gladly add to this forum.

evilC
Cave Troll
Posts: 49
Joined: Thu Mar 21, 2013 3:29 pm
Location: London, UK

Re: Notepad++ Maptool Text Editor config file [UPDATE: 5/31/

Post by evilC »

I hear you, but I think that is more a factor of necessity. Even with RPEdit, I found myself using the MT editor because I could not be bothered to copy and paste again - it was quicker to make the edit inside MT.

Can you confirm that with RPEdit, if a code from a newer version of the lib gets pasted in, are all the new buttons created OK etc - is it "safe"?

Also, does the text exported by RPEdit include everything for a Library? All settings, properties etc?

Finally, if whilst inside notepad, I copied and pasted a new macro (giving it a new name obviously), when I paste it back in via RPEdit, is that a safe way of creating a macro?

I see what you are saying about finding the token and I had considered that. It would be trivial to circumvent though - MT remembers where you are on a map, so you can easily automate switching to the correct map, selecting the lib token, doing the copy/paste then switching back to the map you were on.

User avatar
aliasmask
RPTools Team
Posts: 9023
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Notepad++ Maptool Text Editor config file [UPDATE: 5/31/

Post by aliasmask »

Can you confirm that with RPEdit, if a code from a newer version of the lib gets pasted in, are all the new buttons created OK etc - is it "safe"?
Button specific data is in the @PROPS@ line. I have defaults set when not specified so, if you want to only set button color, you would only need to specify that. Putting nothing for an existing button doesn't change any button settings but does update the code.
Also, does the text exported by RPEdit include everything for a Library? All settings, properties etc?
Yes, under PROPS.
Finally, if whilst inside notepad, I copied and pasted a new macro (giving it a new name obviously), when I paste it back in via RPEdit, is that a safe way of creating a macro?
Yes and that's how I create all my macros. I just start typing in notepad and paste in to rpedit when done. I don't worry about button colors and groups until I have a significant number of macros. Then I do a export and rewrite all my code in np++ to get the PROPS added.

As I mentioned before, I don't do much loading from MT, unless I load all.

edit: There is one thing to look out for. Buried somewhere in the rpedit thread it mentions that you can't use &#59 in your code (;) because of how MT does form submits. The way around that is do this "&#"+59. Also, don't edit the macros directly when you have the lib frame open because of the macro indexing. Macros updated get new indexes and will differ from the rpedit saved settings. But if you do, you can close and reopen or hit refresh button.

There are a couple of upgrade to rpedit I thought of that would make things easier, but I hop project to project as it is. Today I'll be finishing up an upgrade to Plothos's spell manager adding DC checks and other info along with altered output and skill roll automation for use with the 3.5/Pathfinder framework.

evilC
Cave Troll
Posts: 49
Joined: Thu Mar 21, 2013 3:29 pm
Location: London, UK

Re: Notepad++ Maptool Text Editor config file [UPDATE: 5/31/

Post by evilC »

You mean do not have the text "&#59" in the source code? I don't think I will be doing that in a hurry (Maybe when I get on to HTML and forms?), but thanks for the heads up.

I have been working more on this workflow automation, and I have hit upon a brilliant technique that I thought I would share.

To tighten integration, when Autohotkey hits a button to trigger a macro in MT, it is actually possible to get MT to "return" values to AHK.
Simply use input to pop up a dialog with the return value as the default value, and it is ready selected for you! Just have AHK hit ctrl-c, and inspect the clipboard and it has it's return value :)

So for example, AHK hits F5 to select a map. MT pops up an input, ahk types the name of the map and sends enter. MT pops up another dialog with the default value "map found". AHK hits ctrl-c, reads the clipboard and knows MT found the map.
Neat eh? ;)

evilC
Cave Troll
Posts: 49
Joined: Thu Mar 21, 2013 3:29 pm
Location: London, UK

Re: Notepad++ Maptool Text Editor config file [UPDATE: 5/31/

Post by evilC »

Initial release of my automated conduit:

http://forums.rptools.net/viewtopic.php ... 94#p238894

User avatar
aliasmask
RPTools Team
Posts: 9023
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Notepad++ Maptool Text Editor config file [UPDATE: 5/31/

Post by aliasmask »

I'll check it out. I assume it saves the whole file, correct? I'm working with a file that has 13000+ lines and it takes a bit to save the whole thing to the token. Think you can do the same thing for a single macro from NP++? Right now, I just keep track of the functions by collapsing all unused ones in NP++ and bookmarking the ones I modify.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Notepad++ Maptool Text Editor config file [UPDATE: 5/31/

Post by wolph42 »

Interesting development, curious to try it out.
aliasmask wrote:I'll check it out. I assume it saves the whole file, correct? I'm working with a file that has 13000+ lines and it takes a bit to save the whole thing to the token. Think you can do the same thing for a single macro from NP++? Right now, I just keep track of the functions by collapsing all unused ones in NP++ and bookmarking the ones I modify.
Agreed. Im currently at 21,000+ lines (1.1+ million characters) for one lib and its a bit 'boggish' to throw the lot to and fro.

reonZ
Kobold
Posts: 12
Joined: Wed Oct 19, 2011 5:46 pm

Re: Notepad++ Maptool Text Editor config file [UPDATE: 5/31/

Post by reonZ »

maptool.xml is not available anymore, if you could upload it once again please.

User avatar
aliasmask
RPTools Team
Posts: 9023
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Notepad++ Maptool Text Editor config file [UPDATE: 5/31/

Post by aliasmask »

reonZ wrote:maptool.xml is not available anymore, if you could upload it once again please.
I haven't edited that page for awhile now, but the closer we get to the end of 1.3 I will make a final revision. The OP has a zip file with all the required files including maptool.xml.

Post Reply

Return to “User Creations”