Hello, function that would be very usefull, get the current $settingsname.
Printable View
Hello, function that would be very usefull, get the current $settingsname.
Why do you need it? When you gonna use this? To get script name? to get script dir?
If so, you can use $curscript
Set the script name on user options and use getuseroption('scriptname')
Will try that RoxZin xD.
works same as loadsettings with name check no diffrence :( infinite loopPHP Code:if $name == 'x' and getuseroption('settings') ~= ('Knight rotworm.xml') then
loadsettings('Knight Rotworm.xml')
end
if $name == 'y' and getuseroption('settings') ~= ('testing ghost pal.xml') then
loadsettings('testing ghost pal.xml')
end
if $name == 'z' and getuseroption('settings') ~= ('Knight Bas.xml') then
loadsettings('Knight Bas.xml')
end
After some testing soemtimes it works sometimes settings dont change, sometimes persistent scvript dont load at all and sometimes cavebot user options changes. I tried forlong time to set this becasue i dont want supervise my accounts every day, more like every weekend, this $checksettings function be realy useful for people who have difrent vocations and want run difrent settings for each character without supervising every day.
@Longerion you're using it wrong. Did you make an option called 'settings' or what? Also, it should be different all the time because it won't return the value inside ().
What I told you to do was: On all your scripts, add on the user options something like this:
{
"type" : "scriptinfo",
"name" : "EK - Banuta"
}
Then, you check the script name with getuseroption('scriptname'), like this. It will return EK - Banuta when you try to get it. In your case, it should be something like this:
if $name == 'x' and getuseroption('scriptname') ~= 'Knight rotworm' then
loadsettings('Knight Rotworm.xml')
elseif $name == 'y' and getuseroption('scriptname') ~= 'testing ghost pal' then
loadsettings('testing ghost pal.xml')
elseif $name == 'z' and getuseroption('scriptname') ~= 'Knight Bas.xml' then
loadsettings('Knight Bas.xml')
end
Im pretty much noob with lua but i finaly did it and it works great.
I run 4 settings, one "reloader" and 3 settings for each character.
Reloader:
PHP Code:local minStamina = 15 * 60 -- In minutes
local accountList = {
{
account = 'aa',
password = 'bb',
character = 'x'
},
{
account = 'aa',
password = 'bb',
character = 'y'
},
{
account = 'aa',
password = 'bb',
character = 'z'
}
}
-- DO NOT EDIT BELOW THIS LINE --
for _, v in ipairs(accountList) do
v.character = v.character:lower()
end
if $stamina < minStamina then
local curAccount = table.find(accountList, $name:lower(), 'character')
local nextAccount = accountList[(curAccount % #accountList) + 1]
waitandlogout()
waitping()
keyevent(VK_ESCAPE)
waitping()
connect (nextAccount.account, nextAccount.password, nextAccount.character)
end
if $name == 'x' then
loadsettings('Knight Rotworm.xml')
elseif $name == 'y' then
loadsettings('testing ghost pal.xml')
elseif $name == 'z' then
loadsettings('Knight bz.xml')
end
In every farming settiings i have check when in depo as action:
In every farming settings i have persistent so cavebot starts running :PHP Code:--[XT] Depositer --
depotaction('mainbpdp', 'stackbp', {'b','raredpstackbpdp'})
local minStamina = 14* 60 -- In minutes
if $stamina < minStamina then
loadsettings('Reload.xml')
end
Also have reconecter script i found on forum, i put as persistent and turn it on/off in cavebot action so it dont colide with Reloader:PHP Code:auto(1000)
setcavebot('on') -- sets cavebot on
gotolabel('diip', 'Depositing')
I have to start persistent scripts through editing files but it's ok.PHP Code:auto(1000, 1500)
--[[
Name: Auto Safe Reconnect Lite by BlakW
Version: v5.1.0
]]--
----- Safe Temple Settings -----
--Temple NPCs:
local templeNpcNames = {"Alia", "Tyrias", "Brewster", "Rahkem", "Kasmir", "Amanda", "Isimov", "Yberius", "Maealil", "Quentin", "Lynda", "Lorietta", "Prezil", "Kjesse", "Asralius"}
--Temple Position Range (sqm):
local templePositionRange = 7
----- Engine [Do not edit unless you know what you are doing] -----
if ($connected == false and $dead == false)
then
reconnect()
wait(600, 1800)
pausewalking(10000)
if (($pzone == true) and (maround_ib(10, false, unpack(templeNpcNames)) >= 1)
or ($pzone == true) and (islocationxyz_ib(32787, 31276, 7, templePositionRange))
or ($pzone == true) and (islocationxyz_ib(32595, 32744, 6, templePositionRange))
or ($pzone == true) and (islocationxyz_ib(33213, 32454, 1, templePositionRange))
or ($pzone == true) and (islocationxyz_ib(32213, 31133, 7, templePositionRange))
or ($pzone == true) and (islocationxyz_ib(33004, 31490, 11, templePositionRange))
or ($pzone == true) and (islocationxyz_ib(32649, 31925, 11, templePositionRange))
or ($pzone == true) and (islocationxyz_ib(33217, 31814, 8, templePositionRange))
or ($pzone == true) and (islocationxyz_ib(32317, 32826, 7, templePositionRange))
or ($pzone == true) and (islocationxyz_ib(33194, 32853, 8, templePositionRange))
or ($pzone == true) and (islocationxyz_ib(32369, 32241, 7, templePositionRange))
or ($pzone == true) and (islocationxyz_ib(32360, 31782, 7, templePositionRange))
or ($pzone == true) and (islocationxyz_ib(32957, 32076, 7, templePositionRange))
or ($pzone == true) and (islocationxyz_ib(32732, 31634, 7, templePositionRange))
or ($pzone == true) and (islocationxyz_ib(33447, 31323, 9, templePositionRange)))
then
wait(1500)
closeclient()
wait(1500)
messagebox("Reconnect Message: Tibia client has been closed because character was inside a temple. This is to protect your character from being killed by other players.")
end
wait(10000, 15000)
end
Thats it i hope it helps someone, sorry for spamming forum with requests and thx for everyone for helping me. All scripts i use are edited scripts i picked from this forum.