Save as filename get-ip.js
Before u use this script i make sure u have a copy of the config.lua file.
It should work on all open tibia servers.
Place the "get-ip.js" in same folder as config.lua.
Add "get-ip.js" in your restarter and u always have updated global IP in the config.lua file.
a restarter may look like this :
File : Restarter.BAT
Code:
var request = new ActiveXObject("Msxml2.XMLHTTP");
var notyetready = 1;
request.onreadystatechange=function(){
if(request.readyState==4)
{
notyetready = 0;
fs = new ActiveXObject("Scripting.FileSystemObject");
f = fs.GetFile("config.lua");
newfile = fs.CreateTextFile("new.txt", true);
// Open the file
is = f.OpenAsTextStream( 1, 0 );
while( !is.AtEndOfStream )
{
look_1 = -1;
rline = is.ReadLine();
look_1 = rline.indexOf("ip = \"")
if (look_1 == 0)
{
newfile.writeLine("ip = \"" + request.responseText + "\"");
}
else
{
newfile.writeLine(rline);
}
}
newfile.close();
is.close();
f.Delete();
fs.moveFile("new.txt", "config.lua");
}
}
request.open( "GET", "http://www.whatismyip.com/automation/n09230945.asp", true );
request.send(null);
while( notyetready )
{
WScript.Sleep( 100 );
}
Before u use this script i make sure u have a copy of the config.lua file.
It should work on all open tibia servers.
Place the "get-ip.js" in same folder as config.lua.
Add "get-ip.js" in your restarter and u always have updated global IP in the config.lua file.
a restarter may look like this :
File : Restarter.BAT
Code:
echo off
title Evolutions Server
cls
:controllerini
get-ip.js
Evolutions-XML.exe
echo :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo :: Your Server crashed, the restarter is restarting your Server. ::
echo :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
goto :controllerini
Last edited: