first commit

This commit is contained in:
cclecle
2022-07-27 00:54:39 +02:00
commit 52a1011527
6 changed files with 439 additions and 0 deletions

238
Help/SendTo.txt Normal file
View File

@@ -0,0 +1,238 @@
-------------------------------
SendTo_v07 by {LSN}Meindratheal
-------------------------------
Note: There is also a version of this that works with Nexgen112. If you are running
Nexgen then I would advise you to use NexgenSendToWebsite112 instead.
-----------
What Is It?
-----------
SendTo enables you to add extra say commands to link to Internet pages, other
servers, and the like.
This is the next incarnation of SendToWebsite. It was renamed because websites
are not the only place you can SendTo now.
-----------------------
Installing from scratch
-----------------------
1. Ensure your server is properly shut down.
2. Copy the following files to your server's System folder:
SendTo_v07c.u
3. If your server uses file redirect, upload SendTo_v07c.u.uz
to the redirect file server.
4. Open your server's INI file, and add the following lines to [Engine.GameEngine]:
ServerPackages=SendTo_v07c
If you are using this as a ServerActor, also add this:
ServerActors=SendTo_v07c.STWActor
or
ServerActors=SendTo_v07c.STWActorExt
depending on whether you want the configuration to be help within the server's
INI file, or externally in SendTo.ini
Otherwise, add this to your server's mutator line:
SendTo_v07c.STWMut
or
SendTo_v07c.STWMutExt
depending on whether you want the configuration to be help within the server's
INI file, or externally in SendTo.ini
5. Enter the details for each command, using the correct format (see Format)
6. Save the changes to the INI file and restart the server.
--------------------------------
Upgrading from SendTo_v07a
--------------------------------
1. Ensure your server is properly shut down.
2. Copy the following files to your server's System folder:
SendTo_v07c.u
3. If your server uses file redirect, upload SendTo_v07c.u.uz
to the redirect file server.
4. Open your server's INI file, and replace the following in [Engine.GameEngine]:
ServerPackages=SendTo_v07b
changes to
ServerPackages=SendTo_v07c
If you are using this as a ServerActor, also change this:
ServerActors=SendTo_v07b.STWActor
to
ServerActors=SendTo_v07c.STWActor
or
ServerActors=SendTo_v07b.STWActorExt
to
ServerActors=SendTo_v07c.STWActorExt
depending on whether you want the configuration to be held within the server's
INI file, or externally in SendTo.ini
Otherwise, in your server's mutator line, change this:
SendTo_v07b.STWMut
to
SendTo_v07c.STWMut
or
SendTo_v07b.STWMutExt
to
SendTo_v07c.STWMutExt
depending on whether you want the configuration to be help within the server's
INI file, or externally in SendTo.ini
5. If you are using the server's configuration file, rename the part in your server's INI
titled [SendTo_v07b.STWMut] to [SendTo_v07c.STWMut] .
Otherwise, rename the part in SendTo.ini titled [SendTo_v07b.STWMutExt] to [SendTo_v07c.STWMutExt].
6. Save the changes to the INI file(s) and restart the server.
----------------
List of Commands
----------------
These are the currently supported commands.
!STWHelp Shows the commands you specify.
Of course, the extra commands you add in will be supported.
If they weren't, this would be useless :D
Your custom commands can either be called by saying them exactly as written in the
configuration, or by typing 'mutate STW <yourcommand>' in the console.
------
Format
------
If you run this mod once, it will create a new section at the bottom of your
server's INI file. Edit this to your liking.
Generic Settings:
bShowHelpMessage=True Shows a message saying
'say !STWHelp for a list of available commands.'
bShowCommandsOnJoin=True Shows the messages for all commands with bAdvertise
set.
Per-Command Settings:
bAdvertise[0]=1 Set to 0 if you don't want this to be shown anywhere,
in the help, e.g. for an admin-only forum.
bHideCmd[0]=0 Set this to 1 if you don't want the command to be
broadcast. For example, if you have an admin forum
with !A as the command, and bHideCmd is 1 for this
then no-one else will see the !A message when someone
says it. This does not stop people using it though!
Message[0]= The help message. Make sure it tells users what the
command actually is (e.g. 'Type !F to visit the forum').
If bAdvertise is 0 for this command, then Message can
be left blank.
LongCmd[0]= The long version of the command (e.g. !Forum). Must be
preceded by an exclamation mark (!)
ShortCmd[0]= The short version of the command (e.g. !F). Must be
preceded by an exclamation mark (!)
TargetURL[0]= The actual web address to link to (e.g. www.UnrealAdmin.org).
If you are linking to a UT server, it must be written as
unreal://<your-ip>:<port>
You can have up to 64 different command lists, and you may have multiple commands linking to
the same website.
For a quick template, look at the INIFormat.txt file.
WARNING: Although conflicts are checked for and warned about for custom commands, there is no
such checking for Nexgen commands or similar. Therefore, it is up to you to make sure commands
don't conflict with other mods.
-------
Contact
-------
You can find me on the UnrealAdmin.org and UT99.org forums, under the name
'Meindratheal'. I am not the best at writing UnrealScript, since I can only
do it in my spare time, but I am willing to try to make a mod for people,
so if you have any reasonable requests then ask away!
-------
Credits
-------
Daan 'Defrost' Scheerens: First and formemost, for creating such a brilliant
server controller, and for leaving the code intact.
I have learnt most of my coding from Nexgen, so I
thank you. I have used a few bits and pieces from
Nexgen, notably the say command detection.
iloveut99: The code you showed me was helpful in writing this.
back4more: The suggestions you gave were good, so I implemented them
The UnrealWiki: The Offline Wiki has been invaluable for me, however
old it may be. It has been the other key element in
my UScript learning. Thanks go out to all contributors!
The UnrealAdmins forum: I wrote this for you guys, and I think it might actually
be quite useful to people. Nice idea!
Other: Please do not re-compile the SendTo_v07c package, as
it may cause version mismatches. Source code is included so
you can see how it works. If you do recompile it, then a) make
a post in the forum thread on UnrealAdmin saying what you changed
(it might be a major bug, it might just be preference) b) make
sure you give it a new, non-generic name, and c) keep me credited!
---------
Changelog
---------
Version 0.7c:
--¤Fixed the external configuration loader
Version 0.7b:
--¤Removed some old debugging code
--¤Added the option to use an external configuration (choose the correct ServerActor)
Version 0.7a:
--¤Fixed bHideCmd not working (I think)
Version 0.7:
--¤Fixed a few minor bugs
--¤Added the 'ListLinks' command
--¤Changed the list size to 64
Version 0.6:
--¤Brought it roughly on par with the Nexgen version.
Fixed bugs with validation, URL's and the bHidden flag.
Version 0.5:
--¤Initial release.

56
Help/SendTo_INIFormat.txt Normal file
View File

@@ -0,0 +1,56 @@
;You can paste this into your server's INI file and it should work with no changes.
;However, you should change it to meet your requirements.
[SendTo_v07c.STWMut]
bAdvertise[0]=1
bAdvertise[1]=0
bAdvertise[2]=1
bAdvertise[3]=1
bAdvertise[4]=0
bAdvertise[5]=0
bAdvertise[6]=1
bAdvertise[7]=1
bHideCmd[0]=0
bHideCmd[1]=1
bHideCmd[2]=0
bHideCmd[3]=0
bHideCmd[4]=0
bHideCmd[5]=0
bHideCmd[6]=0
bHideCmd[7]=0
Message[0]=Say !Forum to go to the forum.
Message[1]=Say !Admin to go to the admin area.
Message[2]=Say !Apply to apply to join our clan.
Message[3]=Say !Google to load google :D
Message[4]=
Message[5]=
Message[6]=Say !Server1 to go to the server at 127.0.0.1:7777
Message[7]=Say !Server2 to go to the server at 127.0.0.1:7800
LongCmd[0]=!Forum
LongCmd[1]=!Admin
LongCmd[2]=!Apply
LongCmd[3]=!Google
LongCmd[4]=
LongCmd[5]=
LongCmd[6]=!Server1
LongCmd[7]=!Server2
ShortCmd[0]=!F
ShortCmd[1]=!A
;These commands will conflict. The first in the list takes precedence.
ShortCmd[2]=!A
ShortCmd[3]=!G
ShortCmd[4]=
ShortCmd[5]=
ShortCmd[6]=!1
ShortCmd[7]=!2
TargetURL[0]=www.test.com/Forum
TargetURL[1]=://www.test.com/Admin
TargetURL[2]=HTTP://www.test.com/Apply
TargetURL[3]=http://www.google.com
TargetURL[4]=
TargetURL[5]=
TargetURL[6]=unreal://127.0.0.1:7777
TargetURL[7]=unreal://127.0.0.1:7800
bShowCommandsOnJoin=True
bShowHelpMessage=True
DeathsForWelcome=0

2
Readme.md Normal file
View File

@@ -0,0 +1,2 @@
# SendTo Release GIT repository

BIN
Redirect/SendTo_v07c.u.uz Normal file

Binary file not shown.

143
Run.sh Normal file
View File

@@ -0,0 +1,143 @@
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
OUTPUT_DIR="$2"
CFG_FILE="$3"
DEFAULT_CFG_FILE=UnrealTournament.ini
function add_iniKeyEx() {
crudini --set $OUTPUT_DIR/System/$1 $2 __$3 $4
# Warning: ugly hack with sed to allow multiple key instances + to remove space around '='
sed -i "s/[[:space:]]*__$(echo $3 | sed -e 's/\([[\/.*]\|\]\)/\\&/g')[[:space:]]*=[[:space:]]*/$(echo $3 | sed -e 's/\([[\/.*]\|\]\)/\\&/g')=/g" $OUTPUT_DIR/System/$1
}
function set_iniKeyEx() {
crudini --set $OUTPUT_DIR/System/$1 $2 $3 $4
}
# !!Warning!! section is not considered
function del_iniKeyEx() {
sed -i "/[[:space:]]*$(echo $3 | sed -e 's/\([[\/.*]\|\]\)/\\&/g')[[:space:]]*=[[:space:]]*$(echo $4 | sed -e 's/\([[\/.*]\|\]\)/\\&/g')/d" $OUTPUT_DIR/System/$1
}
function add_iniKey() {
add_iniKeyEx $CFG_FILE $1 $2 $3
}
function set_iniKey() {
set_iniKeyEx $CFG_FILE $1 $2 $3
}
# !!Warning!! section is not considered
function del_iniKey() {
del_iniKeyEx $CFG_FILE $1 $2 $3
}
function add_ServerPackage() {
add_iniKey 'Engine.GameEngine' ServerPackages $1
add_iniKey 'XC_Engine.XC_GameEngine' ServerPackages $1
}
function del_ServerPackage() {
del_iniKey 'Engine.GameEngine' ServerPackages $1
del_iniKey 'XC_Engine.XC_GameEngine' ServerPackages $1
}
function add_ServerActors() {
add_iniKey 'Engine.GameEngine' ServerActors $1
add_iniKey 'XC_Engine.XC_GameEngine' ServerActors $1
}
function del_ServerActors() {
del_iniKey 'Engine.GameEngine' ServerActors $1
del_iniKey 'XC_Engine.XC_GameEngine' ServerActors $1
}
function getmodprefix() {
UFile=$(find $OUTPUT_DIR/System -type f -iname "SendTo_v*.u" -exec basename {} \;)
BaseName="${UFile%.*}"
echo "$BaseName"
}
function install() {
rsync -a $SCRIPT_DIR/System/ $OUTPUT_DIR/System/ --exclude '.git'
rsync -a $SCRIPT_DIR/Helps/ $OUTPUT_DIR/Helps/ --exclude '.git'
echo install ok
}
function enable() {
BaseName="$(getmodprefix)"
add_ServerPackage $BaseName
add_ServerActors "$BaseName.STWActorExt"
echo enable ok
}
function disable() {
BaseName="$(getmodprefix)"
del_ServerPackage $BaseName
del_ServerActors "$BaseName.STWActorExt"
echo disable ok
}
function show_help() {
echo
echo "Usage: $0 { getmodprefix | install | enable | disable } <UT99_INSTALL_DIR> [<UT99_CONFIG_FILE>] [<CONFIG_KEY> <CONFIG_VALUE>]"
echo
}
function check_cfg_file_config() {
if [ $# -eq 4 ]
then
echo "CFG_FILE is unset, setting it to $DEFAULT_CFG_FILE"
CFG_FILE=$DEFAULT_CFG_FILE
elif [ $# -eq 5 ]
then
echo "CFG_FILE is set to '$CFG_FILE'"
else
echo "Wrong number of arguments"
show_help
exit 9999 # die with error code 9999
fi
if [ ! -f $OUTPUT_DIR/System/$CFG_FILE ]
then
echo "$OUTPUT_DIR/System/$CFG_FILE does not exist"
show_help
exit 9999 # die with error code 9999
fi
}
function check_cfg_file_gen() {
if [ -z ${CFG_FILE} ]
then
echo "CFG_FILE is unset, setting it to $DEFAULT_CFG_FILE"
CFG_FILE=$DEFAULT_CFG_FILE
else
echo "CFG_FILE is set to '$CFG_FILE'"
fi
if [ ! -f $OUTPUT_DIR/System/$CFG_FILE ]
then
echo "$OUTPUT_DIR/System/$CFG_FILE does not exist"
show_help
exit 9999 # die with error code 9999
fi
}
function check_game_dir() {
### Check if a directory does not exist ###
if [ -z $OUTPUT_DIR ]
then
echo "incorrect <UT99_INSTALL_DIR>"
show_help
exit 9999 # die with error code 9999
fi
}
case "$1" in
'getmodprefix')
check_game_dir
getmodprefix
;;
'install')
check_game_dir "$@"
install "$@"
;;
'enable')
check_game_dir "$@"
check_cfg_file_gen "$@"
disable "$@"
enable "$@"
;;
'disable')
check_game_dir "$@"
check_cfg_file_gen "$@"
disable "$@"
;;
*)
show_help
exit 1
;;
esac
exit 0

BIN
System/SendTo_v07c.u Normal file

Binary file not shown.