Page 1 of 1
Temp Friend
Posted: Thu Feb 09, 2012 11:25 am
by richi
Can somebody tell me why
Code: Select all
<!-- # 1 --><waypoint x="-27897" z="32817" y="-279">
table.insert(settings.profile.options.friends, "namehere");
</waypoint>
don't work ?
There come : [string "..."]:2: bad argument #1 to 'insert' <table expected, got nil>
Re: Temp Friend
Posted: Thu Feb 09, 2012 11:51 am
by kkulesza
Re: Temp Friend
Posted: Thu Feb 09, 2012 12:26 pm
by richi
What's wrong with
Code: Select all
<!-- # 2 --><waypoint x="-26084" z="33576" y="-145">
settings.profile.friends["namehere"] = nil;
</waypoint>
?
It should reverse the first code but it also don't work
Re: Temp Friend
Posted: Thu Feb 09, 2012 1:19 pm
by rock5
Actually no.
Code: Select all
table.insert(settings.profile.friends, "namehere");
Inserts it with a number. eg.
Code: Select all
settings.profile.friends[num] = "namehere"
You would have to first search for the value before you could delete it.
To save you the trouble, Lisa wrote a userfunction to do something like that. I think it was called changeOptionFriendMob. Do a search.
Re: Temp Friend
Posted: Thu Feb 09, 2012 5:42 pm
by kuripot
not sure but you can try
Code: Select all
settings.profile.friends = {"Name of Mobs","Name of Mobs"}
and also put in your userfunction folder
Re: Temp Friend
Posted: Thu Feb 09, 2012 8:02 pm
by lisa
richi wrote:settings.profile.friends["namehere"] = nil;
The table is a numbered system
1 = "name"
2 = "namelol"
3 = "namers"
So as rock said you would need to do
Code: Select all
settings.profile.friends[num] = "namehere"
if you want no names in the table.
which creates a blank table.
This is a simple little userfunction I made a while back.
Usage is like this
Code: Select all
changeOptionFriendMob("mob", "Wolf", "Add")
changeOptionFriendMob("friend", "Hokeypokey", "Remove")
So state
friend or mob
name
add or remove
default is to add, so if 3rd arg is nil then it will add.
Re: Temp Friend
Posted: Fri Feb 10, 2012 12:56 am
by rock5
Lisa I noticed your function still doesn't check if the name already exists. So if continuously reloading the file, you will end up with multiple entries of the same name.
Re: Temp Friend
Posted: Fri Feb 10, 2012 2:29 am
by lisa
yeah I haven't changed this since I made so very very long ago.
I don't even use it anymore anyway, I used to use it for KS when I would fly over the first boss. so add it to friends to make sure not to attack it while flying over it.