Forums
September 30, 2020, 11:40 PM

Author Topic: wkmacros  (Read 657 times)

0 Members and 1 Guest are viewing this topic.

Offline GrO

  • 🌞🌞🌞🌞♾️🌞🌞🌞🌞
  • Jr. Member
  • **

  • Poland Poland
  • Posts: 86
  • ⚘🌹🌷 🌿 🌻 🍀 🌷🌹⚘
    • View Profile
    • 440Hz >>> 432Hz
Re: wkmacros
« Reply #15 on: September 02, 2020, 02:05 PM »
Your script is not working for me, it's in an infinite loop of sending the first sentence, I had to call Ctrl+Alt+Del hahah.
I think it's behaving like that because you forgot to use comma after the Send command.
...weird, I didn't test it though, but it doesn't differ from their examples: https://www.autohotkey.com/docs/commands/Send.htm#Repeating_or_Holding_Down_a_Key

...you're using the latest AHK version?

BTW, thank you for your advanced script, it may be very useful.

Regards...

...even the Light needs a background, or some dirt, to become visible... ...

Offline Kaleu

Re: wkmacros
« Reply #16 on: September 03, 2020, 02:47 AM »
Your script is not working for me, it's in an infinite loop of sending the first sentence, I had to call Ctrl+Alt+Del hahah.
I think it's behaving like that because you forgot to use comma after the Send command.
...weird, I didn't test it though, but it doesn't differ from their examples: https://www.autohotkey.com/docs/commands/Send.htm#Repeating_or_Holding_Down_a_Key

...you're using the latest AHK version?

BTW, thank you for your advanced script, it may be very useful.

Regards...

Yes I am using the lastest ahk :)
I used these guides, it's basically ther Beginner Tutorial.
https://www.autohotkey.com/docs/Tutorial.htm#s12

No need to thank, enjoy!
Experience the best TTRR gameplays with my maps!

→ The best of Kaleu ←

Offline GrO

  • 🌞🌞🌞🌞♾️🌞🌞🌞🌞
  • Jr. Member
  • **

  • Poland Poland
  • Posts: 86
  • ⚘🌹🌷 🌿 🌻 🍀 🌷🌹⚘
    • View Profile
    • 440Hz >>> 432Hz
Re: wkmacros
« Reply #17 on: September 03, 2020, 08:22 AM »
I've updated the example script (also attached it):

- now you need to hold "Alt" for binds to work (so the script won't interfere with chatting),
- added commas after 'Send' commands (thx to Kaleu),
- added some popular rules:

Code: [Select]
; INFO: "!j" = "Alt"+"j"    ; if you want to use "Ctrl" instead, just swap:
;                                      "!" with "^" (omit the quotes)
;
; codepage := 65001    ; uncomment the start of this line for UTF-8 encoding,
;                                  remember to save the script as 'Unicode big endian'
;
; to produce a literal commas or percent signs, you need to use so-called
; escape sign before each, example:    "`," and "`%"
;
; "`n"    ; makes a new line like "Enter"
;
!j::
  Send, Shopper rules:`n- crate before attack`,`n- kill the leader`,`n- attack from rope.
  Send, {Enter}
Return

!k::
  Send, Forts rules:`n- no invading`,`n- no fishing.
  Send, {Enter}
Return

!l::
  Send, Get the latest updates from:`nhttps://worms2d.info/Updates
  Send, {Enter}
Return


Yes I am using the lastest ahk :)
I used these guides, it's basically ther Beginner Tutorial.
https://www.autohotkey.com/docs/Tutorial.htm#s12

No need to thank, enjoy!
...dunno if you want it this way, but maybe you could use the below example to upgrade your script, so it'll eliminate the need of using the end-char to send the phrase:

Quote
:*:btw::by the way  ; Replaces "btw" with "by the way" without needing an ending character.


*edit*

...just tested my script and it's doing it's job really well, you can even send multi-line text with the in-game chat, while "`n" function works a little bit differently than I initially thought...

...it creates a totally new line, not another line in the same phrase, what bypasses the max characters limit that can be typed in one phrase - I like it :D
« Last Edit: September 03, 2020, 11:05 AM by GrO »

...even the Light needs a background, or some dirt, to become visible... ...

Offline terion

Re: wkmacros
« Reply #18 on: September 03, 2020, 01:26 PM »
wkTextMacros-v1
This module implements automatic text macros in both lobby and in-game chat.

Usage:
1) Upon first launch, the module will create a macros/ directory inside your WA installation dir.
2) Inside macros/ directory create a .txt file with the name of your desired command (for example, macros/rules.txt will be available as /rules command)
3) Edit this file with notepad and fill it with your desired text macro (save it as plaintext, ascii file)
4) When in lobby or in-game, type /macros to see a list of all available commands
5) Type the name of your command to send the text to all players

Notes:
- The text files are scanned and read on game launch and whenever you use /macros command. Thus macro file creation/modification/deletion will be reflected only when you type /macros command or restart the game.
- Text macros in lobby are sent as a single message and are limited to 1024 characters
- Text macros in-game are split by newline character into separate messages and are limited to 256 characters per line. Up to 3 text lines can be used in a single macro.
- Spamming text macros will trigger automatic /ignore by all players, so keep your macros short and use this module with moderation.
- Do not use space or other special characters in command names
- Do not use command names that overlap with bult-in game commands (/test, /version, etc)
- This module has been tested with WA version 3.8.0. It will not work with WA 3.7.2.2 and earlier versions. It might work with newer WA releases if no significant changes are made to lobby or game chat functions.

Offline GrO

  • 🌞🌞🌞🌞♾️🌞🌞🌞🌞
  • Jr. Member
  • **

  • Poland Poland
  • Posts: 86
  • ⚘🌹🌷 🌿 🌻 🍀 🌷🌹⚘
    • View Profile
    • 440Hz >>> 432Hz
Re: wkmacros
« Reply #19 on: September 03, 2020, 02:17 PM »
wkTextMacros-v1
This module implements automatic text macros in both lobby and in-game chat.
...really good work, thanks :)


*edit*

...I've tested it more and it doesn't print all lines from the text files. In my files the 1st line is empty, so I assume it shows 3 first lines of each file (the picture attached)
« Last Edit: September 03, 2020, 04:43 PM by GrO »

...even the Light needs a background, or some dirt, to become visible... ...

Offline GrO

  • 🌞🌞🌞🌞♾️🌞🌞🌞🌞
  • Jr. Member
  • **

  • Poland Poland
  • Posts: 86
  • ⚘🌹🌷 🌿 🌻 🍀 🌷🌹⚘
    • View Profile
    • 440Hz >>> 432Hz
Re: wkmacros
« Reply #20 on: September 03, 2020, 03:36 PM »
...I've made a few basic files for wkTextMacros-v1 module


*edit*

...btw, tested and it's working fantastic. Thanks again.

Regards...


*edit II*

I've tested it more and it doesn't print all lines in the in-game chat, as shown on the screenshot attached to the previous post (due to attachment count limitation).
« Last Edit: September 03, 2020, 04:49 PM by GrO »

...even the Light needs a background, or some dirt, to become visible... ...

Offline GrO

  • 🌞🌞🌞🌞♾️🌞🌞🌞🌞
  • Jr. Member
  • **

  • Poland Poland
  • Posts: 86
  • ⚘🌹🌷 🌿 🌻 🍀 🌷🌹⚘
    • View Profile
    • 440Hz >>> 432Hz
Re: wkmacros
« Reply #21 on: September 03, 2020, 05:43 PM »
...I've made another upgrade, so now my script prints marked text at AG, the green text in the Lobby and the green text within the in-game chat (see the screenshots attached):

Code: [Select]
; INFO: "!j" = "Alt"+"j"    ; if you want to use "Ctrl" instead, just swap:
;                                      "!" with "^" (omit the quotes)
;
; codepage := 65001    ; uncomment the start of this line for UTF-8 encoding,
;                                  remember to save the script as 'Unicode big endian'
;
; to produce a literal commas or percent signs, you need to use so-called
; escape sign before each, example:    "`," and "`%"
;
; "`n"    ; makes a new line like "Enter"
;
!j::
  Send, /me : Shopper rules:`n/me : - crate before attack`,`n/me : - kill the leader`,`n/me : - attack from rope.
  Send, {Enter}
Return

!k::
  Send, /me : Forts rules:`n/me : - no invading`,`n/me : - no fishing.
  Send, {Enter}
Return

!l::
  Send, /me : Get the latest updates from:`n/me : https://worms2d.info/Updates
  Send, {Enter}
Return


...even the Light needs a background, or some dirt, to become visible... ...

Offline terion

Re: wkmacros
« Reply #22 on: September 03, 2020, 09:18 PM »
...I've tested it more and it doesn't print all lines from the text files. In my files the 1st line is empty, so I assume it shows 3 first lines of each file (the picture attached)

This is an intentional limitation of the module to minimize the risk of being automatically muted by other players, as WA has built-in anti-flood mechanism. If you send multiple in-game chat messages in short time period, you will be automatically muted without any warning and your chat messages will be ignored by other players until the round ends or other players use /unignore command.

Offline readyworm

Re: wkmacros
« Reply #23 on: September 06, 2020, 03:45 PM »
Great work, Terion!