Page 1 of 1

671, added a function for bank usage

Posted: Tue Nov 08, 2011 3:49 am
by lisa
revision 671.
Nothing huge, just added in a function for bank usage.


Usage is as follows.

Code: Select all

local name, id, count, slot = bankItemBySlot(slotnumber)
If you know the slot you want to check then do
for slot 1

Code: Select all

local name, id, count, slot = bankItemBySlot(1)
If you want to look through bank to find something then

Code: Select all

tokencount = 0
for slotnumber = 1,40 do
local name, id, count, slot = bankItemBySlot(slotnumber)
if id == 204874 then -- phirius tokens
tokencount = tokencount + count
end
end
print("Total tokens in bank "..tokencount.."\n")
That will print to MM window exactly how many phirius tokens you have in your bank, regardless of where you are in the world.
With this info you could do a check and if enough to buy a purified fusion stone then you can go to the bank and remove all the tokens to your bag and then buy a puri.

Anyway that is just 1 example

--=== Note ===--
I only did slots 1-40, if you own more then 1 tab then we might need to look at it differently, not sure if using slot 41 would work.
It is limited to 40 slots (1 tab) at this stage.

Re: 671, added a function for bank usage

Posted: Wed Nov 09, 2011 6:13 am
by rock5
As I checked for updates because I'm about to make a commit, I noticed that Administrator recently did a commit. She seems to have deleted your new function. She does that occationally. :D So recommit it, or if you like I can commit it again for you when I do my commit. Let me know if you want me to do it.

Re: 671, added a function for bank usage

Posted: Wed Nov 09, 2011 6:54 am
by lisa
Maybe she didn't like my function lol
Yeah if you can add it back it that would be good thanks

Re: 671, added a function for bank usage

Posted: Wed Nov 09, 2011 9:27 am
by rock5
np.

I'm just doing a couple of small changes. Something I've wanted to do for awhile is have pawn update check for id change and set to 0 if changed. Id numbers chould never change. That way we don't have to check the id range or other checks we do to see if a pawn is still valid. We can just do a pawn:update() and check if id is 0. Also the way it is now it's possible the pawn isn't valid anymore but the id number changes to a valid value so it thinks it's still valid. This should fix that.

Re: 671, added a function for bank usage

Posted: Wed Nov 09, 2011 12:14 pm
by Administrator
Sorry about that. I'm not sure how I managed to delete that function when I had reverted and updated everything just prior to having messed with that.

Have you at least noticed whether or not the code I have added is working or not? I've only been able to test it by manually inducing a crash, but that might given different results than a naturally occurring one.