[Tool][PRPL100] Alternate Land Editor (with hotkeys!)(beta)

Started by Stickman, February 14, 2017, 12:29:35 PM

Previous topic - Next topic

Stickman

Why should I (it means you, Reader) even try this?
Because it wouldn't take much time (5-10 minutes, tops) and I've got either overwhelmingly positive or no feedback on this.

Why is it a beta?
I think it's not feature-complete, for example, I want to add mire brush. You are welcome to suggest features. Any feedback is welcome.

It looks like this:
Spoiler
[close]

It works like this:
After setting up images and attaching script to PRPLCore, hold L to show land editor "cursor" and additional information. Releasing L hides "cursor" and information.
While holding L:
J,K - press shortly change brush size up and down; hold to change brush size quickly; brush range - from 1 to untested.
U,I - press to change land height up and down; land height range - from 0 to 5
Left Click - press or hold to create land (or delete if land height is set to 0) of required size
Right Click - press or hold to delete land of required size
; (semicolon) - press to switch additional information (brush size and land height) on and off
' (quote) - press press to switch between square and "round" brushes.

Features:

  • Right-clicking to delete land
  • Ability to create land that looks somewhat round
  • Supports both even and odd square brushes adequately enough
  • Supports more brush sizes than normal editor
  • Will suicide if not in editor
  • Can be used with normal land editor to quickly fix mistakes
  • Can be used with normal land editor to quickly create complex structures (sometimes in one click) like:
    Spoiler
    [close]
  • HOTKEYS!
  • Hotkeys don't use any keys from normal control layout
  • Maybe bugs

Problems:

  • Doesn't disable normal control inputs. Dragging mouse with left-click will show select box, and dragging with right-click, by default, moves map around
  • Hard to see minimum size brush. Large brushes obscure terrain
  • Bad images
  • No inputs attached
  • Clunky, needs time to get used to
  • Probably bugs

Code:

# --LandEditor-- 1/23/2017 1:52:43 AM
once
1 operatewhilepaused
self "main" "NONE" setimage
self "Circle" "Custom0" setimage
self "Circle" 255 255 255 0 setimagecolor
self "Circle" "UI" setimagelayer
self "Square" "Custom1" setimage
self "Square" 255 255 255 0 setimagecolor
self "Square" "UI" setimagelayer
true ->LandMode
3 ->BrushSize
1 ->LandHeight

0.333 ->ScaleMult
self "Circle" <-ScaleMult <-BrushSize mul dup setimagescale
self "Square" <-ScaleMult <-BrushSize mul dup setimagescale

true ->ShowText
30 ->sextextsize

4 ->FastBrushLimiter
endonce

iseditmode eq0 if
self 0 destroyunit
endif

"L" getkeydown if
<-LandMode if
self "Square" 255 255 255 175 setimagecolor
else
self "Circle" 255 255 255 175 setimagecolor
endif
endif

"L" getkeyup if
self "Square" 255 255 255 0 setimagecolor
self "Circle" 255 255 255 0 setimagecolor
"" settext
endif

"L" getkey if
getmousecell celltopixel ->PixelMouseY ->PixelMouseX
currentpixelcoords ->PixelCoreY ->PixelCoreX
<-PixelMouseY <-PixelCoreY sub ->OffsetY
<-PixelMouseX <-PixelCoreX sub ->OffsetX

<-BrushSize 2 mod eq0 if
<-OffsetX 2 sub ->OffsetX
<-OffsetY 2 add ->OffsetY
endif

self "Square" <-OffsetX <-OffsetY 0 setimageposition
self "Circle" <-OffsetX <-OffsetY 0 setimageposition


<-ShowText if
<-OffsetX 15 add settextx
<-OffsetY 15 sub settexty
"LH: " <-LandHeight concat LF concat "BS:" concat <-BrushSize concat settext
endif


endif

"L" getkey "K" getkeydown and if
<-LandMode if
<-BrushSize 1 add ->BrushSize
else
<-BrushSize 2 add ->BrushSize
endif
self "Circle" <-ScaleMult <-BrushSize mul dup setimagescale
self "Square" <-ScaleMult <-BrushSize mul dup setimagescale
<-FastBrushLimiter ->FastBrushDelay
endif

"L" getkey "K" getkey and if
<-FastBrushDelay eq0 if
<-LandMode if
<-BrushSize 1 add ->BrushSize
else
<-BrushSize 2 add ->BrushSize
endif
self "Circle" <-ScaleMult <-BrushSize mul dup setimagescale
self "Square" <-ScaleMult <-BrushSize mul dup setimagescale
else
<-FastBrushDelay 1 sub ->FastBrushDelay
endif
endif

"L" getkey "J" getkeydown and if
<-BrushSize 1 gt if
<-LandMode if
<-BrushSize 1 sub ->BrushSize
else
<-BrushSize 2 sub ->BrushSize
endif
endif
self "Circle" <-ScaleMult <-BrushSize mul dup setimagescale
self "Square" <-ScaleMult <-BrushSize mul dup setimagescale
<-FastBrushLimiter ->FastBrushDelay
endif

"L" getkey "J" getkey and if
<-FastBrushDelay eq0 if
<-BrushSize 1 gt if
<-LandMode if
<-BrushSize 1 sub ->BrushSize
else
<-BrushSize 2 sub ->BrushSize
endif
endif
self "Circle" <-ScaleMult <-BrushSize mul dup setimagescale
self "Square" <-ScaleMult <-BrushSize mul dup setimagescale
else
<-FastBrushDelay 1 sub ->FastBrushDelay
endif
endif

"L" getkey "I" getkeydown and if
<-LandHeight 5 lt if
<-LandHeight 1 add ->LandHeight
endif
endif

"L" getkey "U" getkeydown and if
<-LandHeight 0 gt if
<-LandHeight 1 sub ->LandHeight
endif
endif

"L" getkey 0 getmousebutton and if
<-LandHeight @customsetland
endif

"L" getkey 1 getmousebutton and if
0 @customsetland
endif

"L" getkey "Semicolon" getkeydown if
<-ShowText not ->ShowText
"" settext
endif

"L" getkey "Quote" getkeydown if
<-LandMode if
<-BrushSize 2 mod eq0 if
<-BrushSize 1 sub ->BrushSize
endif
endif
<-LandMode not ->LandMode
self "Square" 255 255 255 0 setimagecolor
self "Circle" 255 255 255 0 setimagecolor
<-LandMode if
self "Square" 255 255 255 175 setimagecolor
else
self "Circle" 255 255 255 175 setimagecolor
endif
endif

:customsetland
->TemporaryHeight
getmousecell ->MouseY ->MouseX
<-LandMode if
<-BrushSize 2 mod eq0 if
2 0 do
2 0 do
<-MouseX I sub <-MouseY J add <-TemporaryHeight <-BrushSize 2 div 1 sub 1 setlandbulk
loop
loop
else
<-MouseX <-MouseY <-TemporaryHeight <-BrushSize 1 sub 2 div 1 setlandbulk
endif
else
<-MouseX <-MouseY <-TemporaryHeight <-BrushSize 1 sub 2 div 0 setlandbulk
endif

:destroyed
0 operatewhilepaused

:awake
1 operatewhilepaused


Attached: test map
=====> This is a moderately pointy stick. You need to poke me with it once in three days if you need PRPL from me

FOXX

                                              REVIEW

                    Setup after download -> Easy 3 step.

1 - Put the Script in the ScriptFolder of your map, Hit Compile.
2 - Attach Circle Image to Custom0 , Square Image to Custom1.
3 - Place a PRPL Core somewhere out of the way [in a Corner] and Add Script to it.
Ready to go !

Press L to see if you get a little square around your mouse cursor. If not then Save and Load the map and should be Ok.

                     Controls

With the L as the center key the positioning of the Hotkeys couldn't be done better without interfering with Ingame Keys.
With one hand you control the mouse and with the other hand you control the Hotkeys.
MouseControl -> LeftClick is Add Land [Hold Button and Move to Constantly Add Land]
                       -> RightClick is Remove Land [Remember this]
I put my middle finger on the L and with my other fingers i press the other Hotkeys.
This can take some practice but it is not hard to learn.

                     Practical Use

At the start you will have to get used to the Controls a bit but you can build Circles and Squares from different sizes very easily. Even if you are not fast in the beginning, adding land is still much faster so you save time.
Within a couple of minutes you can build a landmass with shapes  that without this Script would take a long time.

I almost hear you thinking 'How big can i go'
Well ....
Bigger then you probably will use in maps
[close]

And if you switch between Circles and Squares.
Done in only minutes
[close]
Notice on the right the deleted Circle where the Enemy Energy Mine is placed. In the normal Editor there is no function for this. [For deleting round parts for placing objects (Enemy Mine) this is a perfect tool]

If you make a big Circle or Square first and then delete smaller bits you can make Awesome land creations. [See Images Stickman posted] And with deleting land you don't have to go to the delete option in the normal Editor every time.

One more Example
[close]

                       Conclusion

If you want to make a map with [bigger] Circles and/or Squares this Tool makes it a lot easier for you.
I have used this a couple of times now and i really like this Tool.
Also working together with the normal Editor works fine. In the normal Editor you can select the brush and height you want for later. Hold the L and you have this Tool selected, release the L and the normal Editor works again. And so you can switch to what Editor you need at the moment.
Even the Problems Stickman listed i don't see as problems:
Problems

Quote from: Stickman on February 14, 2017, 12:29:35 PM
Problems:

  • Doesn't disable normal control inputs. Dragging mouse with left-click keep adding land, and dragging with right-click, by default, moves map around
  • Hard to see minimum size brush. Large brushes obscure terrain
  • Bad images
  • No inputs attached
  • Clunky, needs time to get used to
  • Probably bugs



  • No problem for me, with the L pressed down you still can move the screen. That is actually very nice to use.
  • Zoom in. No problems here yet.
  • Maybe it can be 'Modernized' but not really necessary. It works that is more important.
  • For now this is ok. It works. But inputs are always interesting. Maybe in the future different shapes [Rectangle, Star. I don't know what is possible]
  • There is a learning curve but not to hard.
  • No bugs here, works good!
[close]

                       End Conclusion

When you start with a map [specially big maps] and you have this setup as a sort of an overlay you always have the 'L' option there.
It is a very handy Tool.




The FPAF
For My Maps and Ships!
Including  CUSTOM MODULE MAPS & SHIPS