Echo on toggle function

Request help for teeworlds-related subjects (mapping, servers, ..).
For client issues, see our repositories (https://github.com/ddnet/ddnet/issues).
Post Reply
User avatar
Shocker
Posts: 19
Joined: Sun Dec 20, 2015 7:31 pm
Location: Chile
Player profile: https://ddnet.tw/players/Shocker/
Clan: pichula

Echo on toggle function

Post by Shocker »

Hey, I'm looking for a way to put an echo message on a toggle, e.g., I want to bind a single key to toggle antiping and recieve a message "antiping on/off"
I can easily bind 2 keys for that:

Code: Select all

bind key1 "cl_antiping 0; echo antiping off"
bind key2 "cl_antiping 1; echo antiping on"
Idk if there's a way to put both binds together on a key, like:

Code: Select all

bind key "toggle cl_antiping 0 1; toggle echo "antiping on" "antiping off" "
I thought it can be done using cfg files, but I don't know if I can call 2 differents cfg files with exec function bounds on a single key.
Any way to do this? Thanks.
pichula > 123wena
User avatar
deen
TECHNICAL Team
Posts: 3575
Joined: Mon May 05, 2014 2:30 pm
Player profile: https://ddnet.org/players/deen/
Discord: deen#5910

Re: Echo on toggle function

Post by deen »

antipingon.cfg:

Code: Select all

cl_antiping 1
echo antiping on
bind v exec antipingoff.cfg
antipingoff.cfg:

Code: Select all

cl_antiping 0
echo antiping off
bind v exec antipingon.cfg
Then just F1, exec antipingon.cfg
User avatar
Shocker
Posts: 19
Joined: Sun Dec 20, 2015 7:31 pm
Location: Chile
Player profile: https://ddnet.tw/players/Shocker/
Clan: pichula

Re: Echo on toggle function

Post by Shocker »

Wow nice, thanks deen :D
pichula > 123wena
Index
Posts: 1133
Joined: Mon May 05, 2014 7:30 pm
Clan: Eagle

Re: Echo on toggle function

Post by Index »

Yeah thanks for the idea :3 That can be added to extend sooo many useful binds.
Maybe I'll someday write a paragraph about it in the Just bind It Tutorial for sure .__.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests