#EVENT {PROGRAM START}
{
#class worlddata read worlddata.tin;
#if {&{worldlist} == 0}
{
#class worlddata open;
#list worldlist clear;
#class worlddata close
}
}
#ALIAS {addworld}
{
#if {"%3" == ""}
{
#showme Syntax: addworld <name> <host> <port> [character name] [password]
};
#else
{
#variable worldlist[%1][name] %1;
#variable worldlist[%1][host] %2;
#variable worldlist[%1][port] %3;
#if {"%4" != ""}
{
#variable worldlist[%1][char] %4
};
#if {"%5" != ""}
{
#variable worldlist[%1][pass] %5
};
#if {&worldlist[%1][char]}
{
#showme The world %1 (%2 %3) and the character %4 (%5) has been added.
};
#else
{
#showme The world %1 (%2 %3) has been added.
};
#class worlddata write worlddata.tin
}
}
#ALIAS {deleteworld}
{
#if {&worldlist[%1] != 0}
{
#unvariable worldlist[%1];
#class worlddata write worlddata.tin;
#showme The world %1 has been deleted.
};
#else
{
#showme The world %1 could not be found.
}
}
#ALIAS {connect}
{
#if {"%1" == ""}
{
#echo {%h} {{ WORLD LIST }};
#foreach {*worldlist[]} {world}
{
#echo {%-20s %s %s %s} {$worldlist[$world][name]} {$worldlist[$world][host]} {$worldlist[$world][port]} {$worldlist[$world][char]}
}
};
#elseif {&worldlist[%1] != 0}
{
#variable mud {%1};
#session $worldlist[%1][name] $worldlist[%1][host] $worldlist[%1][port]
};
#else
{
#showme Could not find world %1.
}
}
#EVENT {SESSION CONNECTED}
{
#variable mud @gts{$mud};
#if {&worldlist[$mud]}
{
#if {&worldlist[$mud][char]}
{
#send {$worldlist[$mud][char]};
#if {&worldlist[$mud][pass]}
{
#send {$worldlist[$mud][pass]}
}
}
}
}
|