• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[Solved] [HELP] Function ErrorMessage?

Status
Not open for further replies.
Level 9
Joined
Aug 7, 2009
Messages
380
Helloz once again
What function and how to use it (custom script) ? It somehow call up a message just like warning something (Not enough mana, Inventory is full ...etc)
And how to use it?
I use: call DebugError ( GetOwningPlayer(GetTriggerUnit()), "Message") but it makes the map unable to load
I'm using patch 1.24e
 
Meaby you meant BJDebugMsg?

Since it looks like:
JASS:
function BJDebugMsg takes string msg returns nothing
    local integer i = 0
    loop
        call DisplayTimedTextToPlayer(Player(i),0,0,60,msg)
        set i = i + 1
        exitwhen i == bj_MAX_PLAYERS
    endloop
endfunction
You can call it via:
  • Custom script: call BJDebugMsg("Message")
You can also use:
  • Custom script: call DisplayTimedTextToPlayer(Player(0),0,0,60,"Message")
To display message just for one player. Here I post how function above looks like so you can understand what each parameter means:
JASS:
native DisplayTimedTextToPlayer     takes player toPlayer, real x, real y, real duration, string message returns nothing]
 
Hello guys, he is trying to simulate an interface error message, not trying to learn jass message function.
 
Create a new trigger, Edit -> convert to custom text. Delete all text and paste the following in there:

JASS:
library SimError initializer init
//**************************************************************************************************
//*
//*  SimError
//*
//*     Mimic an interface error message
//*       call SimError(ForPlayer, msg)
//*         ForPlayer : The player to show the error
//*         msg       : The error
//*    
//*     To implement this function, copy this trigger and paste it in your map.
//* Unless of course you are actually reading the library from wc3c's scripts section, then just
//* paste the contents into some custom text trigger in your map.
//*
//**************************************************************************************************

//==================================================================================================
    globals
        private sound error
    endglobals
    //====================================================================================================

    function SimError takes player ForPlayer, string msg returns nothing
        set msg="|cffffcc00"+msg+"|r"
        //if (GetLocalPlayer() == ForPlayer) then
            call ClearTextMessages()
            if ForPlayer == null then
                //call BJDebugMsg("id: " + I2S(GetPlayerId(ForPlayer)))
            endif
            //call DisplayTimedTextToPlayer(ForPlayer, 0.52, 0.96, 2.00, msg)
            call DisplayTimedTextToPlayer(ForPlayer, 0, 0, 2.00, msg)
            call StartSound(error)
        //endif
    endfunction

    private function init takes nothing returns nothing
         set error=CreateSoundFromLabel("InterfaceError",false,false,false,10,10)
         //call StartSound( error ) //apparently the bug in which you play a sound for the first time
                                    //and it doesn't work is not there anymore in patch 1.22
    endfunction

endlibrary

Then use it like this:
  • Custom script: call SimError(GetOwningPlayer(GetTriggerUnit()), "hello")
 
Make sure you have Jass NewGen Pack v5d.

Otherwise, just use this:
JASS:
//Needs a udg_SimError global sound variable
function SimError takes player ForPlayer, string msg returns nothing
    if udg_SimError==null then
        set udg_SimError=CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
    endif
    if (GetLocalPlayer() == ForPlayer) then
        call ClearTextMessages()
        call DisplayTimedTextToPlayer( ForPlayer, 0.52, -1.00, 2.00, "|cffffcc00"+msg+"|r" )
        call StartSound( udg_SimError )
    endif
endfunction
 
Status
Not open for further replies.
Back
Top