Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*===================================================================================*\
- | Sign Builder script by WolfieMario |
- | Feel free to use for Minecraft or other purposes, and feel free to make changes. |
- | I would appreciate if you do not remove this notice if distributing this script. |
- | I am not liable for any way in which you use or abuse this script. |
- \*=================================================================================\ /
- */
- ; You can pre-set lines of text for the script to use here.
- ; Put text inside the quotes only. It can be changed later with Alt+I.
- line1 := ""
- line2 := ""
- line3 := ""
- line4 := ""
- ; If you game is slow and Alt+B (Build Sign) does not work, make this number bigger.
- delayStep := 70
- ; Its default value is 70.
- /*==============================*\
- / Script Command Reference \
- /===============v==========^==================================^=========================\
- | Hotkeys | Description |
- |---------------|-----------------------------------------------------------------------|
- | Alt+I | Input lines of text to be typed onto signs. |
- | Alt+T | Type stored lines of text onto sign (have sign interface open). |
- | Alt+V | Type text from clipboard into game (allows "pasting" on signs). |
- | Alt+B | Build Sign: Place a sign, type all stored text, and confirm. |
- \===============^=======================================================================/
- |____ Everything beyond this is actual code. Play at your own risk! |
- \ /================================================================================/
- \ /
- */
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- #Warn ; Recommended for catching common errors.
- ; Prevents script from interfering with (most) non-Minecraft windows
- GroupAdd, Minecraft, ahk_class SunAwtFrame ; Minecraft 1.5.2 and earlier
- GroupAdd, Minecraft, ahk_class LWJGL ; Minecraft 1.6 and later
- #IfWinActive ahk_group Minecraft
- #MaxThreadsPerHotkey 2
- hasText := !textEmpty()
- !I:: inputText()
- !T:: typeText()
- !V:: SendInput %Clipboard%
- !B:: buildSign()
- buildSign()
- {
- global delayStep, hasText
- Click Right
- Sleep delayStep
- if(hasText) ;Is there any text to put on the signs?
- {
- typeText()
- Sleep delayStep
- }
- SendInput {Escape}
- }
- typeText()
- {
- global line1, line2, line3, line4
- SendInput {Raw}%line1%
- SendInput {Down}
- SendInput {Raw}%line2%
- SendInput {Down}
- SendInput {Raw}%line3%
- SendInput {Down}
- SendInput {Raw}%line4%
- }
- inputText()
- {
- global hasText
- static popupWidth := 220
- static inputWidth := 170
- static inputOffset := (popupWidth - inputWidth) / 2
- static buttonWidth := 75
- static buttonOffset := (popupWidth - buttonWidth * 2 - 6) / 2
- Gui New, +LastFound, Input Sign Text
- Gui Add, Text, Center W%popupWidth% X0 Y10, Input lines of text for sign (max 15 char/line):
- Gui Font, S12, Courier New Bold
- Loop, 4
- {
- Gui Add, Edit, % "Vline" . A_Index . " Limit15 Center 0x200 wp" . (A_Index = 1 ? " Y+10 W" . inputWidth . " X" . inputOffset : ""), % line%A_Index%
- }
- Gui Font
- Gui Add, Button, gGuiSubmit Default W%buttonWidth% X%buttonOffset%, OK
- Gui Add, Button, gGuiClose W%buttonWidth% yp X+6, Cancel
- Gui Show, W%popupWidth%
- WinWaitClose % "AHK_ID " WinExist()
- hasText := !textEmpty()
- }
- textEmpty()
- {
- global line1, line2, line3, line4
- return line1 = "" and line2 = "" and line3 = "" and line4 = ""
- }
- GuiSubmit:
- guiButtonPressed := A_GuiControl
- Gui Submit
- Return
- GuiClose:
- GuiEscape:
- guiButtonPressed := "Close"
- Gui Cancel
- Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement