Page 1 of 1

Function player:updatebuffs() not available

Posted: Tue May 04, 2021 4:14 am
by Rintintin
As meentioned on
https://www.solarstrike.net/wiki/index. ... _Functions

there should be a function to update the buffs of a player or target. But this does not work (anymore)

Code: Select all

    for k,v in pairs (player.Buffs) do 
        if  v.Id ~= 503827 then goto continue end 
            print (v.Name.." "..v.Count) 
        ::continue::
    end
This code will return the desired buffs but no updates afterwards.

Re: Function player:updatebuffs() not available

Posted: Wed May 05, 2021 11:08 am
by Administrator
You may need to call

Code: Select all

player.updateBuffs()
first. I'm not sure exactly what you are attempting to do, so I think that function isn't automatically called for you in your circumstances.

That would look something like...

Code: Select all

    player.updateBuffs()
    for k,v in pairs (player.Buffs) do 
        if  v.Id ~= 503827 then goto continue end 
            print (v.Name.." "..v.Count) 
        ::continue::
    end

Re: Function player:updatebuffs() not available

Posted: Tue May 11, 2021 10:07 am
by Rintintin
Well I tried the command from the commandline but it threw an error

Code: Select all

player.updateBuffs()
onLoad error: D:/rombot/scripts/rom/classes/pawn.lua:429: attempt to index local 'self' (a nil value)

Re: Function player:updatebuffs() not available

Posted: Tue May 11, 2021 10:33 am
by Administrator
Sorry, my mistake. That should have been a colon (:) instead of dot (.):

Code: Select all

player:updateBuffs();

Re: Function player:updatebuffs() not available

Posted: Wed May 12, 2021 2:57 pm
by Rintintin
Oh yes, that does the trick and seems to work.