• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

[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