Warcraft III resources & community, 2003–2006 · archived

JASS Error, please help

4 posts
#1

JASS Error, please help

Can anyone tell me what's wrong with these JASS scripts?


//***************************************************************************
//*
//* Global Variables
//*
//***************************************************************************

globals
    // User-defined
    string                 udg_playername
    unit                    udg_hero                 = null

    // Generated
    trigger                 gg_trg_Localized_Chat_Init = null
    trigger                 gg_trg_Localized_Chat_Unit = null
    trigger                 gg_trg_Localized_Chat     = null
    trigger                 gg_trg_Show_Variables     = null
endglobals

function InitGlobals takes nothing returns nothing
    set udg_playername = ""
endfunction

function Trig_Localized_Chat_Actions takes nothing returns nothing
    local player udg_playername
    local unit udg_hero
    call CreateTextTagUnitBJ( ( udg_playername + ( "Says" + GetEventPlayerChatString() ) ), udg_hero, 0, 10, 100, 100, 100, 0 )
endfunction

//===========================================================================

function InitTrig_Localized_Chat takes nothing returns nothing
    set gg_trg_Localized_Chat = CreateTrigger( )
    call TriggerRegisterPlayerChatEvent( gg_trg_Localized_Chat, GetLocalPlayer(), "", false )
    call TriggerAddAction( gg_trg_Localized_Chat, function Trig_Localized_Chat_Actions )
endfunction



AND


//***************************************************************************
//*
//*  Global Variables
//*
//***************************************************************************

globals
    // User-defined
    string                  udg_playername
    unit                    udg_hero                   = null

    // Generated
    trigger                 gg_trg_Localized_Chat_Init = null
    trigger                 gg_trg_Localized_Chat_Unit = null
    trigger                 gg_trg_Localized_Chat      = null
    trigger                 gg_trg_Show_Variables      = null
endglobals

function InitGlobals takes nothing returns nothing
    set udg_playername = ""
endfunction

function Trig_Show_Variables_Actions takes nothing returns nothing
    local player udg_playername
    local unit udg_hero
    call DisplayTextToPlayer( GetTriggerPlayer(), 0, 0, ( udg_playername + UnitId2StringBJ(GetUnitTypeId(udg_hero)) ) )
endfunction

//===========================================================================
function InitTrig_Show_Variables takes nothing returns nothing
    set gg_trg_Show_Variables = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_Show_Variables, GetLocalPlayer(), "-sv", true )
    call TriggerAddAction( gg_trg_Show_Variables, function Trig_Show_Variables_Actions )
endfunction

The ones that WE says have errors are
call CreateTextTagUnitBJ( ( udg_playername + ( "Says" + GetEventPlayerChatString() ) ), udg_hero, 0, 10, 100, 100, 100, 0 )

AND

call DisplayTextToPlayer( GetTriggerPlayer(), 0, 0, ( udg_playername + UnitId2StringBJ(GetUnitTypeId(udg_hero)) ) )




EDIT: I had tried remaking the triggers and they work now,this has been solved.
#2
Anyone there?
#3
I haven't tested it, but it may be because you can't use a string global as a player local. And if it's not giving you compile errors, just doesn't work, it's because locals always have to be set before used.

Blade
#4
Well I was tricking the WE into thinking the udg_s ares locals with a tutorial over at wc3c.