• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] JASS Error, please help

Status
Not open for further replies.
Level 6
Joined
Nov 7, 2004
Messages
48
Can anyone tell me what's wrong with these JASS scripts?


JASS:
//***************************************************************************
//*
//* 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


JASS:
//***************************************************************************
//*
//*  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.
 
Level 7
Joined
May 6, 2005
Messages
390
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
 
Status
Not open for further replies.
Top