- Joined
- Nov 13, 2006
- Messages
- 1,814
[SOLVED] Floating Text or floatingtext variable problem, not appear simple
y i know have triggerscript section but facts, everytime when i posted there i got 0 response to problem (yes, ZERO, Null )
problem is the following, i save the floating text to hashtable,, everytime user click to specific slot then read from hash, check if floating text value in hash isnt null and destroy it if null then want create another one and save to same place in hash (overall refresh a floating text)
BUT after 1st time when i click (so 2nd,3rd time) its allways show the saved texttag isnt null in hashtable :/
so from 2 number sometimes show to me 1 or nothing but if tt == null allways return with false even i saved null to hash, also this hashtable never flushed or overwrited with any other thing also floating text/player dont reach the 100 (it is around 6-7) and most funny thing randomly dissapear another floating text what dont have any relation with this function (really sometimes 1 sometimes another floating text)
solved, i thought the destroying the texttag automatically null the pointer in hashtable but that was false :/
y i know have triggerscript section but facts, everytime when i posted there i got 0 response to problem (yes, ZERO, Null )
problem is the following, i save the floating text to hashtable,, everytime user click to specific slot then read from hash, check if floating text value in hash isnt null and destroy it if null then want create another one and save to same place in hash (overall refresh a floating text)
BUT after 1st time when i click (so 2nd,3rd time) its allways show the saved texttag isnt null in hashtable :/
so from 2 number sometimes show to me 1 or nothing but if tt == null allways return with false even i saved null to hash, also this hashtable never flushed or overwrited with any other thing also floating text/player dont reach the 100 (it is around 6-7) and most funny thing randomly dissapear another floating text what dont have any relation with this function (really sometimes 1 sometimes another floating text)
JASS:
function FadeSlot takes integer pl, integer slot, integer opacity, boolean apply returns nothing
local real x = LoadReal(udg_Inv_Slots, slot, 1)
local real y = LoadReal(udg_Inv_Slots, slot, 2)
local texttag tt = LoadTextTagHandle(udg_Inv_Slots, 1000, 10000 * pl + slot)
local integer c = 0
local integer alphaImg = 255
local image Img
if GetLocalPlayer() == Player(pl - 1) then
set alphaImg = opacity
endif
if slot > 2302 and slot < 2306 then
if udg_Camera_Lock[GetPlayerId(GetLocalPlayer()) + 1] == 2 then
set c = LoadInteger(udg_Inv_Slots, 2405, - (100 + pl + ((slot - 2302) * 20 - 20)))
endif
else
set c = 1
endif
set Img = LoadImageHandle(udg_Inv_Slots, 2406, 10000 * pl + slot)
if apply then
if tt != null then
call DestroyTextTag(tt)
set tt = null
if c > 0 then
if GetLocalPlayer() == Player(pl - 1) then
set tt = CreateTextTag()
call SetTextTagText( tt, I2S(c), 0.7 * 0.023 )
call SetTextTagPos( tt, x + 8, y - 25, 30.00 )
call SetTextTagColor( tt, 255, 255, 255, 155 )
call SetTextTagPermanent( tt, true )
endif
endif
call SaveTextTagHandle(udg_Inv_Slots, 1000, 10000 * pl + slot, tt)
call DisplayTextToPlayer(Player(pl - 1), 0, 0, "-exist-" + I2S(c) + " slot " + I2S(slot) + " hashtable adress: udg_Inv_Slots,1000," + I2S(10000 * pl + slot) )
//it is allways return with correct c (so not 0), correct slot
//so everytime exclude 1st time i see:
//-exist-3 slot 2303 hashtable adress: udg_Inv_Slots, 1000, 12303
// c was 3
else
set tt = null
if c > 0 then
if GetLocalPlayer() == Player(pl - 1) then
set tt = CreateTextTag()
call SetTextTagText( tt, I2S(c), 0.7 * 0.023 )
call SetTextTagPos( tt, x + 8, y - 25, 30.00 )
call SetTextTagColor( tt, 255, 255, 255, 155 )
call SetTextTagPermanent( tt, true )
endif
endif
call SaveTextTagHandle(udg_Inv_Slots, 1000, 10000 * pl + slot, tt)
call DisplayTextToPlayer(Player(pl - 1), 0, 0, "-not exist-" + I2S(c) + " slot " + I2S(slot) + " hashtable adress: udg_Inv_Slots,1000," + I2S(10000 * pl + slot) )
//this appear only 1st time, and show every floating text (i use this function for 2-3 slot only)
//only 1st time its show every floating text like normally, after that this never screwed up and never run this ip part anymore because its see the hashtable slow what i check is allways got value
endif
if Img != null then
call SetImageColor(Img, 255, 255, 255, 255 - opacity)
else
set Img = CreateImage("64x64.blp", 62.00, 62.00, 1, x - 32, y - 32, 1, 0, 0, 0, 1)
call SetImageRenderAlways (Img, true)
call SetImageColor(Img, 255, 255, 255, 255 - alphaImg)
call SetImageConstantHeight (Img, true, 50)
call SaveImageHandle(udg_Inv_Slots, 2406, 10000 * pl + slot, Img)
endif
else
set Img = LoadImageHandle(udg_Inv_Slots, 2406, 10000 * pl + slot)
if Img != null then
call DestroyImage(Img)
call SaveImageHandle(udg_Inv_Slots, 2406, 10000 * pl + slot, null)
endif
call DestroyTextTag(tt)
endif
set tt = null
set Img = null
endfunction
solved, i thought the destroying the texttag automatically null the pointer in hashtable but that was false :/
Last edited: