Page 1 of 2
Quests and more Quests
Posted: Mon Sep 10, 2012 8:13 pm
by ex0r
I did some more quests tonight, here is a synopsis of all the quests i've done so far. (Not sure if it included them in this patch or not so im going to include them anyways)
The Setting Sun (Done and Complete)
Breaking Stones (Done and Complete)
Her Majesty's Garden (Done and Complete)
Stardust (Done and Complete)
Re: Quests and more Quests
Posted: Mon Sep 10, 2012 8:34 pm
by Flunklesnarkin
Awesome work man, quests were one of my favorite parts of FFXI
keep them coming
Re: Quests and more Quests
Posted: Mon Sep 10, 2012 10:34 pm
by ex0r
Over the next week or so I plan on getting quite a bit of them done, been going through the list seeing which ones are done and which ones aren't. I'm still new to scripting so some of the advanced quests I won't be attempting yet, but alot of the other ones I will do for sure.
Re: Quests and more Quests
Posted: Thu Sep 13, 2012 4:53 am
by diatanato
Code: Select all
function alreadyCheckedNPC(player,number)
local wildcatSandy = player:getVar("wildcatSandy_var");
local bit = {};
for i = 19,0,-1 do
twop = 2^i;
if(wildcatSandy >= twop) then
bit[i+1] = 1;
wildcatSandy = wildcatSandy - twop;
else
bit[i+1] = 0;
end;
end;
if(bit[number] == 0) then
return false;
else
return true;
end
end;
can be change to (where 0x80000 is your 20 bit)
Code: Select all
if (player:getVar("wildcatSandy_var") % 2 * 0x80000 >= 0x80000) then;
-- TODO
end
(value % 2 * bit) >= bit -- there is a bit
(value % 2 * bit) < bit -- there isn't a bit
how it work:
1100101001010111b = 51799
1000000b = 64
let's find this bit
1100101001010111b % 2 * 1000000b >= 1000000b (51799 % 2 * 64 >= 64)
2 * 1000000b == 10000000b
% will remove all bits at the beginning (we have 7 bit in 10000000b then will remove 8,9,10,11,12,13,14,15 and 16 bit)
1100101001010111b % 10000000b = 1010111b (01010111b)
now
1010111b >= 1000000b = true
but it work for one bit only
P.S. I hope that I could explain this principle ^^
Re: Quests and more Quests
Posted: Thu Sep 13, 2012 2:16 pm
by Ezekyel
you can delete this part, this quest is not implemented because it's aht urhgan, and now we have new lua function for that
int32 setMaskBit(lua_State*); // Sets a single bit in a character variable
int32 getMaskBit(lua_State*); // Retrieves a single bit in a character variable
int32 isMaskFull(lua_State*); // Checks if a bitmask stored in a character varable of a specified size contains all set bits
Re: Quests and more Quests
Posted: Thu Sep 13, 2012 7:15 pm
by ex0r
I'm sorry, what is this in reference to? I don't remember using any of that stuff in my quest scripts. There was some stuff already in the NPC files, so it's possible somebody else worked on some incomplete stuff.
Re: Quests and more Quests
Posted: Tue Sep 18, 2012 7:34 pm
by ex0r
BUMP metal
Re: Quests and more Quests
Posted: Wed Sep 19, 2012 12:39 am
by diatanato
Ezekyel wrote:you can delete this part, this quest is not implemented because it's aht urhgan, and now we have new lua function for that
int32 setMaskBit(lua_State*); // Sets a single bit in a character variable
int32 getMaskBit(lua_State*); // Retrieves a single bit in a character variable
int32 isMaskFull(lua_State*); // Checks if a bitmask stored in a character varable of a specified size contains all set bits
это не очень хорошее решение в большинстве случаев
check Norg/npcs/Mamaulabion.lua
Code: Select all
if(player:getQuestStatus(OUTLANDS,MAMA_MIA) == QUEST_ACCEPTED) then
if(trade:hasItemQty(1202,1) and trade:getItemCount() == 1) then -- Trade Bubbly water
wasSet = player:getMaskBit("tradesMamaMia",0)
player:setMaskBit("tradesMamaMia",0,true)
if(player:isMaskFull("tradesMamaMia",7) == true) then
player:startEvent(0x00C3); -- Traded all seven items
elseif(wasSet) then
player:startEvent(0x00C2); -- Traded an item you already gave
else
player:startEvent(0x00C1); -- Traded an item
end
wasSet = player:getMaskBit("tradesMamaMia",0) - 1 query to db
player:setMaskBit("tradesMamaMia",0,true) - 2 queries to db
player:isMaskFull("tradesMamaMia",7) == true - 1 query to db
итог: 5 queries
если заменить все это на формулу
(value % 2 * bit) >= bit
то к базе в итоге уйдет лишь 2 queries
2 queries VS 5 queries
Re: Quests and more Quests
Posted: Wed Sep 19, 2012 1:53 am
by bluekirby0
The number of queries can be cut down by caching the variable first (it would add an extra step to the scripting and an extra argument to the functions, but it would bring it down to 2 queries). Those functions do provide a way of using the efficient storage of bitmasks without having to actually understand them, which is a great benefit to the scripters.
Re: Quests and more Quests
Posted: Wed Sep 19, 2012 2:29 am
by diatanato
bluekirby0 wrote:Those functions do provide a way of using the efficient storage of bitmasks without having to actually understand them, which is a great benefit to the scripters.
идея хорошая, но реализация плохая