- Joined
- Jul 10, 2007
- Messages
- 6,306
private static method destroyTag takes nothing returns nothing
local thistype this = table[GetHandleId(GetExpiredTimer())]
call destroy()
endmethod
private static method destroyTag takes nothing returns nothing
call thistype(table[GetHandleId(GetExpiredTimer())]).destroy()
endmethod
private static method loadData takes nothing returns thistype
return table[GetHandleId(GetExpiredTimer())]
endmethod
private static method destroyTag takes nothing returns nothing
call thistype(loadData()).destroy()
endmethod
if IsPlayerInForce(GetLocalPlayer(), f) then
struct TexttagTest extends array
static method print takes string s returns nothing
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, s)
endmethod
static method onInit takes nothing returns nothing
local texttag t = null
local integer count = 0
local integer minId = 9001
local integer maxId = 0
loop
set t = CreateTextTag()
exitwhen t == null
set count = count + 1
if GetHandleId(t) < minId then
set minId = GetHandleId(t)
elseif GetHandleId(t) > maxId then
set maxId = GetHandleId(t)
endif
endloop
call print("Max texttags: " + I2S(count))
call print("Min Id: " + I2S(minId))
call print("Max Id: " + I2S(maxId))
set t = null
endmethod
endstruct
All methods can be used with timers... so there... >.>
It works just fine.
method destroy takes nothing returns nothing
call DestroyTextTag(tag_p)
@call PauseTimer(textTagTimer_p)@ // in some computer the timer will be paused, in other it will still running, and then opening new threads
And boolean is better than a player argument. I chose it purposefully.
The only things that aren't synced are the texttags. Everything else is sync'd exactly. I'm not a noob, lol.
if (createLocal) then
set tagPointer_p = recyclerPointer[0]
if (0 == tagPointer_p) then
set tagPointer_p = localRemaining
if (0 == tagPointer_p) then
set tagPointer_p = thistype(0).next
debug if (0 == tagPointer_p) then
debug call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 10, "Text Tag Overload: Too Many Permanent Text Tags")
debug set tagPointer_p = 1/0
debug endif
call remove()
call DestroyTextTag(tag_p)
set tag_p = null
set tagPointerParent_p[tagPointer_p].tagPointer_p = 0
else
set localRemaining = tagPointer_p - 1
endif
else
set recyclerPointer[0] = tagPointer_p
endif
set tagPointerParent_p[tagPointer_p] = this
set tag_p = CreateTextTag()
else
set tagPointer_p = 0
set tag_p = null
endif
@PurgeAndFire111 :
I don't get what you want mean, opening a thread in a local block wouldn't cause a desync ? (ForForce opens a new thread)
And anyway i'm lost with your suggestion of a force usage, why you would need this ?
"create local texttag" means: each player has 100 texttags, doesn't it?
You don't use ForForce with it. You just use if IsPlayerInForce(GetLocalPlayer(), f) and then type the code that you want to be performed locally. It will execute them only for the players within force f.
scope Sample initializer init
globals
private boolean Is_for_player = false
endglobals
private function init takes nothing returns nothing
local player p = GetLocalPlayer()
set Is_for_player = ( p == Player(1) or p == Player(3) )
if Is_for_player then // local block only for Player(1) and Player(3)
endif
endfunction
endscope
if GetLocalPlayer() == yourPlayer then
set Your_boolean = true
endif
if GetLocalPlayer() == yourPlayer then
set Your_boolean = false
endif
library LocalHelp initializer init
globals
integer Local_id
player Local_p
string Local_s
boolean array Is_local_player_id // excuse the name :p
endglobals
private function init takes nothing returns nothing
set Local_p = GetLocalPlayer()
set Local_id = GetPlayerId(Local_p)
set Local_s = I2S(Local_id)
set Is_local_player_id[Local_id] = true
endfunction
endlibrary
.setVelocity()
and .angle=
, i recognized that the angle you made is Radian not Degree.*bj_DEGTORAD
when calculating because "angle" makes everybody to think about degreebtw, can you "open a hole" at method update for change texttag overtime ????
When i used .setVelocity() and .angle= , i recognized that the angle you made is Radian not Degree.
At least, add a comment about it or add *bj_DEGTORAD when calculating because "angle" makes everybody to think about degree
lifespan = 3.0
creating period= 0.5
lifespan = 3.5
creating period= 0.5
lifespan = 2.4
creating period= 0.4
lifespan = 2.5
creating period= 0.5
lifespan = 3.1
creating period= 0.5
lifespan = 2.2
creating period= 0.4
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
local TextTag tt
set tt= TextTag.createLocal(GetLocalPlayer()== Player(0))
call tt.setPosition(GetRectCenterX(bj_mapInitialPlayableArea), GetRectCenterY(bj_mapInitialPlayableArea),70)
call tt.setText("ABC",12)
call tt.setVelocity(80., 90.)
set tt.lifespan=3.0
set tt.fadepoint=1.1
endfunction
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
set gg_trg_Untitled_Trigger_001 = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Untitled_Trigger_001, 0.5 )
call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction