eval
and trap
you dont wanna see the code. But I think it is neat that bash can implemnt such syntax you can even do named arguments if you want to.eval
is such a powerful toolchore
and call it a dayBREAKING CHANGE:
only feat!:
# Import required libraries from teeworlds_network
require_relative 'path_to/teeworlds_client'
# 1. Initialize the client
# Create a new instance of TeeworldsClient with verbose output enabled
client = TeeworldsClient.new(verbose: true)
# 2. Set up event handlers
# This block is triggered when the client successfully connects to a server
client.on_connected do
puts "Successfully connected to the server!"
# Send an initial message to the chat
client.send_chat("Hello, DDNet!")
end
# This block is triggered whenever a new chat message is received
client.on_chat do |message|
puts "New chat message received: #{message}"
end
# This block is triggered when the connection to the server is lost
client.on_disconnect do
puts "Disconnected from the server."
end
# 3. Connect to the server
# Specify the IP address and port of the target server
server_ip = "127.0.0.1" # Replace with the server's IP
server_port = 8303 # Replace with the server's port
client.connect(server_ip, server_port)
# 4. Perform additional actions
# For example, authenticate with RCON (if required)
rcon_password = "your_rcon_password"
client.send_chat("/login #{rcon_password}")
# 5. Start a loop to keep the script running and processing events
loop do
# You can add logic here for commands, periodic actions, etc.
sleep 1
end
{
"type": "ddnet06",
"created_by": "twmap 0.12.4"
}
So I guess the info i am searching for is simply not there2024-11-25 06:54:32 I server: User has entered the game. ClientId=ID addr=<{...}> sixup=0
2024-11-25 06:54:32 I chat: *** 'User' entered and joined the game
# Import required libraries from teeworlds_network
require_relative 'path_to/teeworlds_client'
# 1. Initialize the client
# Create a new instance of TeeworldsClient with verbose output enabled
client = TeeworldsClient.new(verbose: true)
# 2. Set up event handlers
# This block is triggered when the client successfully connects to a server
client.on_connected do
puts "Successfully connected to the server!"
# Send an initial message to the chat
client.send_chat("Hello, DDNet!")
end
# This block is triggered whenever a new chat message is received
client.on_chat do |message|
puts "New chat message received: #{message}"
end
# This block is triggered when the connection to the server is lost
client.on_disconnect do
puts "Disconnected from the server."
end
# 3. Connect to the server
# Specify the IP address and port of the target server
server_ip = "127.0.0.1" # Replace with the server's IP
server_port = 8303 # Replace with the server's port
client.connect(server_ip, server_port)
# 4. Perform additional actions
# For example, authenticate with RCON (if required)
rcon_password = "your_rcon_password"
client.send_chat("/login #{rcon_password}")
# 5. Start a loop to keep the script running and processing events
loop do
# You can add logic here for commands, periodic actions, etc.
sleep 1
end
2024-11-25 06:54:32 I server: User has entered the game. ClientId=ID addr=<{...}> sixup=0
2024-11-25 06:54:32 I chat: *** 'User' entered and joined the game
https://ddnet.org/funding/
wait this is sorta an account system# Import required libraries from teeworlds_network
require_relative 'path_to/teeworlds_client'
# 1. Initialize the client
# Create a new instance of TeeworldsClient with verbose output enabled
client = TeeworldsClient.new(verbose: true)
# 2. Set up event handlers
# This block is triggered when the client successfully connects to a server
client.on_connected do
puts "Successfully connected to the server!"
# Send an initial message to the chat
client.send_chat("Hello, DDNet!")
end
# This block is triggered whenever a new chat message is received
client.on_chat do |message|
puts "New chat message received: #{message}"
end
# This block is triggered when the connection to the server is lost
client.on_disconnect do
puts "Disconnected from the server."
end
# 3. Connect to the server
# Specify the IP address and port of the target server
server_ip = "127.0.0.1" # Replace with the server's IP
server_port = 8303 # Replace with the server's port
client.connect(server_ip, server_port)
# 4. Perform additional actions
# For example, authenticate with RCON (if required)
rcon_password = "your_rcon_password"
client.send_chat("/login #{rcon_password}")
# 5. Start a loop to keep the script running and processing events
loop do
# You can add logic here for commands, periodic actions, etc.
sleep 1
end
require_relative 'lib/teeworlds_client'
client = TeeworldsClient.new(verbose: false)
client.on_chat do |_, msg|
# note use `next` instead of `return` in the block
next unless msg.message[0] == '!'
case msg.message[1..]
when 'ping' then client.send_chat('pong')
when 'whoami' then client.send_chat("You are: #{msg.author.name}")
when 'list' then client.send_chat(client.game_client.players.values.map(&:name).join(', '))
else client.send_chat('Unknown command! Commands: !ping, !whoami, !list')
end
end
# properly disconnect on ctrl+c
Signal.trap('INT') do
client.disconnect
end
# connect to localhost and block the current thread
client.connect('localhost', 8303, detach: false)
#!/usr/bin/env zsh
message="test text to broadcast and say"
echo "broadcast \"$message\"; say \"$message\"" > /home/Vexar/DDNet/8303.fifo
FULLY FULLY FULLY
declarative, you need to learn the language: nix
need to learn how to setup your SYSTEM
with nix
etcdeselecting deps
can be done on nix aswelldeselecting deps
can be done on nix aswell scrolling scoreboard
PR - which was implemented meh, but the idea was good (edited)rustup show
?rustc
and cargo
. Both should print something instead of "Could not find rustc/cargo", otherwise you either didn't install them correctly or you have to add them to your PATH
variable manuallywhich cargo
cmake -B build -S && cmake --build build
direnv
+ the vscode extension, which lets me define env
ironment variables & much more (it integrates with another config file inside my per-project repos which tells it what packages are needed for development in this dir
, among other things)cmake -B build -S && cmake --build build
sudo pacman -S --needed base-devel cmake curl ffmpeg freetype2 git glew glslang gmock libnotify libpng opusfile python rust sdl2 spirv-tools sqlite vulkan-headers vulkan-icd-loader wavpack x264
sudo pacman -S --needed base-devel cmake curl ffmpeg freetype2 git glew glslang gmock libnotify libpng opusfile python sdl2 spirv-tools sqlite vulkan-headers vulkan-icd-loader wavpack x264
/usr/lib/x86_64-linux-gnu
looks a little suspicious to me, i don't think arch will typically use a nested target arch dir like this for the native architecture (edited)ufw allow $port/udp
connect localhost:port
in ddnet f1 console