PDA

View Full Version : Self.Name() [Help]



yompa93
04-12-2016, 03:20 PM
Yo!

I need help using the Self.Name() function, here's what i'm tryin

If TrainerNameList == true then
if Self.Name() = "name 1" then
local Axe = true
elseif.....

Thanks!

Oscagi
04-12-2016, 05:18 PM
Yo!

I need help using the Self.Name() function, here's what i'm tryin

If TrainerNameList == true then
if Self.Name() = "name 1" then
local Axe = true
elseif.....

Thanks!

What u wanna do with this?

krille09
04-12-2016, 05:24 PM
XenoBot.GetUsername()

yompa93
04-12-2016, 05:52 PM
What u wanna do with this?
I've got different skills trained on my knights and i'm getting annoyed at changing it all the time.


XenoBot.GetUsername()
Thanks :)

yompa93
04-12-2016, 06:07 PM
Here's kind of how it looks like, not working though



Trainers = true -- Wanna go to trainers when logging out?
TrainerNameList = true

-- If you're using the name list below for trainers these should be false!

local Sword = false -- if Trainers, go to Sword trainer
local Axe = false -- if Trainers, go to Axe trainer
local Club = false -- if Trainers, go to Club trainer
local Distance = false -- if Trainers, go to Distance trainer
local Magic = false -- if Trainers, go to Magic trainer



cName = XenoBot.GetUsername()

if TrainerNameList == true then
if cName == "Character 1" then
local Axe = true
elseif cName == "Character 2" then
local Sword = true
elseif cName == "Character 3" then
local Sword = true
elseif cName == "Character 4" then
local Sword = club
end

registerEventListener(WALKER_SELECTLABEL, "onLabel")
function onLabel(label)
if (label == "ReachTrainers") then
Walker.Stop()
if Sword == true then
Self.UseItemFromGround(33238, 32407, 7)
elseif Axe == true then
Self.UseItemFromGround(33241, 32407, 7)
elseif Magic == true then
Self.UseItemFromGround(33237, 32411, 7)
elseif Club == true then
Self.UseItemFromGround(33239, 32411, 7)
elseif Distance == true then
Self.UseItemFromGround(33241, 32411, 7)
end
end
end

Fatality
04-12-2016, 07:07 PM
Here's kind of how it looks like, not working though



Trainers = true -- Wanna go to trainers when logging out?
TrainerNameList = true

-- If you're using the name list below for trainers these should be false!

local Sword = false -- if Trainers, go to Sword trainer
local Axe = false -- if Trainers, go to Axe trainer
local Club = false -- if Trainers, go to Club trainer
local Distance = false -- if Trainers, go to Distance trainer
local Magic = false -- if Trainers, go to Magic trainer



cName = XenoBot.GetUsername()

if TrainerNameList == true then
if cName == "Character 1" then
local Axe = true
elseif cName == "Character 2" then
local Sword = true
elseif cName == "Character 3" then
local Sword = true
elseif cName == "Character 4" then
local Sword = club
end

registerEventListener(WALKER_SELECTLABEL, "onLabel")
function onLabel(label)
if (label == "ReachTrainers") then
Walker.Stop()
if Sword == true then
Self.UseItemFromGround(33238, 32407, 7)
elseif Axe == true then
Self.UseItemFromGround(33241, 32407, 7)
elseif Magic == true then
Self.UseItemFromGround(33237, 32411, 7)
elseif Club == true then
Self.UseItemFromGround(33239, 32411, 7)
elseif Distance == true then
Self.UseItemFromGround(33241, 32411, 7)
end
end
end


cName = XenoBot.GetUsername()

change to

cName = Self.Name()

XenoBot.GetUsername() shows the account you used to log into XenoBot.

yompa93
04-12-2016, 07:12 PM
cName = XenoBot.GetUsername()

change to

cName = Self.Name()

XenoBot.GetUsername() shows the account you used to log into XenoBot.

Back to the beginning then, Self.Name() didnt work either

Oscagi
04-12-2016, 07:36 PM
Back to the beginning then, Self.Name() didnt work either

Gimme some time, and I will do it, I have to test it.

Fatality
04-12-2016, 07:56 PM
Back to the beginning then, Self.Name() didnt work either

Step 1: Are you getting an error? If yes, Post the error, If no, Do step 2.

Step 2: print(Self.Name()) Run that and tell me what it gives you..

(Just say YES if it gives your name, NO if it doesn't)

yompa93
04-12-2016, 08:15 PM
Step 1: Are you getting an error? If yes, Post the error, If no, Do step 2.

Step 2: print(Self.Name()) Run that and tell me what it gives you..

(Just say YES if it gives your name, NO if it doesn't)

I am not getting any error, it just doesnt work.

print(Self.Name()) does indeed work, it shows my name

yompa93
04-12-2016, 08:18 PM
I just removed "local" from local Axe etc and it worked.. Thanks for all the support <3

anoyn
04-12-2016, 08:58 PM
Take local out of the if statements, it reduces the scope of the variable.
so when you leave the if statement variable axe is lost.

Edit: op fixed already

yompa93
04-12-2016, 09:04 PM
Finnished product, if anyone's interested:



TrainerNameList = true -- Wanna use the namelist and set different characters at different trainers?

if not TrainerNameList then
Trainer = "Sword" -- If you're not using the TrainerNameList, you may choose between Sword/Axe/Club/Distance/Magic.
end


--===TrainerNameList====--
cName = Self.Name()
if TrainerNameList == true then
if cName == "name 1" then -- Name of the first character
Trainer = "Axe" -- Which trainer to use on the first character
elseif cName == "name 2" then -- Name of the second character
Trainer = "Sword" -- Which trainer to use on the second character
end
end


And here's the label:



elseif (label == "ReachTrainers") then
Walker.Stop()
if Trainer == "Sword" then
Self.UseItemFromGround(33238, 32407, 7)
elseif Trainer == "Axe" then
Self.UseItemFromGround(33241, 32407, 7)
elseif Trainer == "Magic" then
Self.UseItemFromGround(33237, 32411, 7)
elseif Trainer == "Club" then
Self.UseItemFromGround(33239, 32411, 7)
elseif Trainer == "Distance" then
Self.UseItemFromGround(33241, 32411, 7)
end