Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Solved] Desync on DisplayTextToForce?

Discussion in 'World Editor Help Zone' started by SomeBloke, Apr 27, 2013.

  1. SomeBloke

    SomeBloke

    Joined:
    Apr 27, 2013
    Messages:
    2
    Resources:
    0
    Resources:
    0
    Hi there,

    I'm not really new to JASS but I've never given it any thought til now,
    and now that I have I'm not quite sure whether I got it right, so I thought this would be a good place to ask:

    Code (vJASS):
    function DisplayTextToForce takes force toForce, string message returns nothing
        if (IsPlayerInForce(GetLocalPlayer(), toForce)) then
            // Use only local code (no net traffic) within this block to avoid desyncs.
            call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, message)
        endif
    endfunction


    Will
    Code (vJASS):
    call DisplayTextToForce( GetPlayersAllies(Player(0)), "something" )

    actually (besides from leaking a force) potentially desync the string table between allies and enemies of player red on the first usage,
    because it will write "something" only for his allies? :eekani:


    ~dizzied by his own thoughts,
    SB
     
  2. Chaosy

    Chaosy

    Tutorial Reviewer

    Joined:
    Jun 9, 2011
    Messages:
    11,065
    Resources:
    18
    Icons:
    1
    Maps:
    1
    Spells:
    10
    Tutorials:
    6
    Resources:
    18
    that wont cause a desync since you use the BJ function..
     
  3. Tirlititi

    Tirlititi

    Joined:
    Jul 11, 2010
    Messages:
    396
    Resources:
    12
    Models:
    6
    Maps:
    2
    Spells:
    3
    JASS:
    1
    Resources:
    12
    Fortunatly not ^^.
    You pass
    "something"
    as the argument of a function, wether you are an ally of
    Player(0)
    . The string is stored and appears in the executed code, even if it is not used for display.

    In other words :
    Code (vJASS):
    function RegisterString takes string s returns nothing
    endfunction

    ...
        // That line will register the string, even if it does nothing with it.
        call RegisterString("something")
    ...
     
  4. SomeBloke

    SomeBloke

    Joined:
    Apr 27, 2013
    Messages:
    2
    Resources:
    0
    Resources:
    0
    Ok, thanks guys :)

    Was shocked for a moment there^^
     
  5. WaterKnight

    WaterKnight

    Joined:
    Aug 18, 2009
    Messages:
    4,035
    Resources:
    5
    Maps:
    1
    Tutorials:
    4
    Resources:
    5
    Show me an example where desyncing the string table kills the game.