• 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.

Creating Custom Error Messages

Level 14
Joined
Dec 29, 2009
Messages
931
CREATING CUSTOM ERROR MESSAGES
~Created by Archange1



REQUIREMENTS:
  • A medium-level understanding of the World Editor
  • Understanding variables and their use
  • The ability to read and process information

CREDITS:
  • Vexorian
  • PurgeandFire111
METHOD ONE
A few things to take note of:
  • Not recommended - use method two if possible
  • Harder to use; more annoying than method two
Step One:
To start off, you're going to want to make three variables.
These three variables will be used in method two as well, so you might as well make them now.

NameTypeArray
ErrorSoundSoundNo
ErrorMessageStringNo
ErrorPlayerPlayerNo
- The sound variable is the sound played when the error message pops up.
- The string variable is the message displayed when you tell it to appear.
- The player variable is the player that the message is shown to.

Step Two:
Next you're going to find where you want your custom error message - what trigger you're going to use it for.
Then copy this:

  • YourTrigger
    • Events
    • Conditions
    • Actions
      • Custom script: if udg_ErrorSound == null then
      • Custom script: set udg_ErrorSound = CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
      • Custom script: endif
      • Set ErrorMessage = YourMessage
      • Set ErrorPlayer = YourPlayer
      • Custom script: if GetLocalPlayer() == udg_ErrorPlayer then
      • Custom script: call ClearTextMessages()
      • Custom script: call DisplayTimedTextToPlayer( udg_ErrorPlayer, 0.52, 0.96, 2.00, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00"+udg_ErrorMessage+"|r" )
      • Custom script: call StartSound(udg_ErrorSound)
      • Custom script: endif
Step Three:
Now you're going to fill in those variables if you haven't already.

Once again;
- ErrorMessage is the message displayed when you tell it to appear.
- ErrorPlayer is the player that the message is shown to.

Once you have all that completed, you're done!

METHOD TWO
A few things to take note of:
  • Recommended method
  • Quick and simple to do
  • Doesn't tie up a lot of space in the trigger's actions
Step One:
If you haven't already, make the variables listed in method one.

Step Two:
In the trigger editor, go to your map header and enter the following code:

JASS:
function ErrorMessage takes string error, player whichPlayer returns nothing
    if udg_ErrorSound == null then
        set udg_ErrorSound = CreateSoundFromLabel("InterfaceError",false,false,false,10,10)
    endif
    set error = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00"+error+"|r"
    if GetLocalPlayer()==whichPlayer then
        call ClearTextMessages()
        call DisplayTimedTextToPlayer(whichPlayer,0.52,0.96,2,error)
        call StartSound(udg_ErrorSound)
    endif   
endfunction

Step Three:
Next you're going to find where you want your custom error message - what trigger you're going to use it for.
Then copy this:

  • YourTrigger
    • Events
    • Conditions
    • Actions
      • Set ErrorMessage = YourMessage
      • Set ErrorPlayer = YourPlayer
      • Custom script: call ErrorMessage(udg_ErrorMessage,udg_ErrorPlayer)
Step Four:
Now you're going to fill in those variables if you haven't already.

Once again;
- ErrorMessage is the message displayed when you tell it to appear.
- ErrorPlayer is the player that the message is shown to.

Once you have all that completed, you're done!

ADDITIONALLY
Keep in mind that the SimError is written in vJass, and Almia's tool has a complete different purpose.
 
Last edited:
Level 14
Joined
Dec 29, 2009
Messages
931
http://www.hiveworkshop.com/forums/spells-569/debuglog-v1-2-a-228919/?prev=status%3Da%26u%3DAlmia

You can try this, this is very advanced.
Warcraft 3 messages as limits, so there's no way you can retrieve older messages than cacheing it.Mine can do a lot of lines.
Then make a tutorial. :D
This is the basic side of it. It's only used to mimic the standard error messages, not keep track of them.

For instance, if you cast frost armor on something that already has frost armor, you could make show an error message (like the "not enough lumber/gold" ones),
showing that the unit already has frost armor, and then cancelling the ability or refunding mana or something.

It looks like your system is used for debugging errors found within the map, while this is used only during play. It's not a REAL error, just the message.
I think I over-explained that, but I wanted to be sure you saw the difference. ^^

Correct me if I'm wrong.
 
Level 14
Joined
Dec 29, 2009
Messages
931
DebugLog v1.2 said:
This records the debugs messages you want,but it wont appear in-game.The debug messages then will be created inside a text document found in a folder path w/c can be configured inside.

This is different tho. T_T
Having the messages outside the game doesn't do much good.

245yfpz.png


This is what the system mimics.
 
Level 14
Joined
Dec 29, 2009
Messages
931
I'd give you rep if I could, because I see what you were doing. ^^

Unfortunately --> dat 24 hour thang. :c

Thanks anyway. :)

EDIT: I just realized while re-reading the tutorial that I put created by Archange1.
The tutorial is, of course, but I DON'T claim credit for the system!
 
Level 14
Joined
Dec 29, 2009
Messages
931
I think that there is no need for all that |n|n|n , correct me if I'm wrong, but you can set text X,Y on screen right?
I wasn't aware of anything like this. x)
Also this is a repost of PurgeandFire111's ideas, not mine.
He just gave me permission to put it into a tutorial for others to see.

How about linking SimError? Because that's where you got the idea :D
I actually got the idea from PurgeandFire111. I've never seen SimError before in my life. ^^

EDIT: Linked both at the bottom of the tutorial.
 
@Kobas: The X-Y parts have limits on how far you can set it. (I don't remember if you can do negative values or not, correct me if I'm wrong) Also, it will move all previous text messages to that spot.

This tutorial looks solid. :) Although, the system isn't really by me, so you can remove the credit about "~System by PurgeandFire".

Approved.
 
Level 14
Joined
Dec 29, 2009
Messages
931
@Kobas: The X-Y parts have limits on how far you can set it. (I don't remember if you can do negative values or not, correct me if I'm wrong) Also, it will move all previous text messages to that spot.

This tutorial looks solid. :) Although, the system isn't really by me, so you can remove the credit about "~System by PurgeandFire".

Approved.

Alright will do I suppose. :s

And thanks. :)
 
Level 2
Joined
Apr 12, 2013
Messages
11
I like it. However I wouldn't really call it an "error message". Maybe I'd call it a "notification message", since error seems to bring to mind something like the program or map crashing :D

Good job to all involved.
 
Level 14
Joined
Dec 29, 2009
Messages
931
I like it. However I wouldn't really call it an "error message". Maybe I'd call it a "notification message", since error seems to bring to mind something like the program or map crashing :D

Good job to all involved.
Well it's titled error message, because the messages that are shown when: for example, you try to building something without enough gold; are called error messages.
 
Level 14
Joined
Dec 29, 2009
Messages
931
BjDebugMsg() has a different purpose entirely. It displays the text to all players for what, 60 seconds?

It's useful for finding problems with triggering, but that's not what this does.
This system is used for creating similar messages like the one below.
245yfpz.png


Unlike your average error messages, these are SUPPOSED to be in-game, as they tell the player some sort of information.
 
Level 3
Joined
Apr 10, 2013
Messages
8
BjDebugMsg will also give this

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
While DisplayTextToPlayer will only give this small code
JASS:
native DisplayTextToPlayer takes player toPlayer, real x, real y, string message returns nothing
 
Level 14
Joined
Dec 29, 2009
Messages
931
BjDebugMsg will also give this

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
While DisplayTextToPlayer will only give this small code
JASS:
native DisplayTextToPlayer takes player toPlayer, real x, real y, string message returns nothing

And that. :p
Ty. <33
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,219
Indeed, however I did not check that properly so this is what I actually meant
  • Untitled Trigger 002
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Custom script: call DisplayTimedTextToForce( bj_FORCE_PLAYER[0], 30, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00"+"error"+"|r" )
this is converted from GUI btw so I know it's not the fastest way but you get the point miss ;)

edit: or this to shorten the code
  • Untitled Trigger 002
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Custom script: call DisplayTimedTextToForce( bj_FORCE_PLAYER[0], 30, "|cffffcc00"+"error"+"|r" )
however it's indeed useful even if I don't like the way this works :)
 
Level 2
Joined
Feb 27, 2021
Messages
10
Unlike real in-game error messages, it would clear all text messages on the player's screen though.
 
Level 7
Joined
Feb 9, 2021
Messages
301
CREATING CUSTOM ERROR MESSAGES
~Created by Archange1




REQUIREMENTS:
  • A medium-level understanding of the World Editor
  • Understanding variables and their use
  • The ability to read and process information

CREDITS:
  • Vexorian
  • PurgeandFire111
METHOD ONE
A few things to take note of:
  • Not recommended - use method two if possible
  • Harder to use; more annoying than method two
Step One:
To start off, you're going to want to make three variables.
These three variables will be used in method two as well, so you might as well make them now.

NameTypeArray
ErrorSoundSoundNo
ErrorMessageStringNo
ErrorPlayerPlayerNo
  • The sound variable is the sound played when the error message pops up.
  • The string variable is the message displayed when you tell it to appear.
  • The player variable is the player that the message is shown to.

Step Two:
Next you're going to find where you want your custom error message - what trigger you're going to use it for.
Then copy this:

  • YourTrigger
    • Events
    • Conditions
    • Actions
      • Custom script: if udg_ErrorSound == null then
      • Custom script: set udg_ErrorSound = CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
      • Custom script: endif
      • Set ErrorMessage = YourMessage
      • Set ErrorPlayer = YourPlayer
      • Custom script: if GetLocalPlayer() == udg_ErrorPlayer then
      • Custom script: call ClearTextMessages()
      • Custom script: call DisplayTimedTextToPlayer( udg_ErrorPlayer, 0.52, 0.96, 2.00, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00"+udg_ErrorMessage+"|r" )
      • Custom script: call StartSound(udg_ErrorSound)
      • Custom script: endif
Step Three:
Now you're going to fill in those variables if you haven't already.

Once again;
  • ErrorMessage is the message displayed when you tell it to appear.
  • ErrorPlayer is the player that the message is shown to.

Once you have all that completed, you're done!

METHOD TWO
A few things to take note of:
  • Recommended method
  • Quick and simple to do
  • Doesn't tie up a lot of space in the trigger's actions
Step One:
If you haven't already, make the variables listed in method one.

Step Two:
In the trigger editor, go to your map header and enter the following code:

JASS:
function ErrorMessage takes string error, player whichPlayer returns nothing
    if udg_ErrorSound == null then
        set udg_ErrorSound = CreateSoundFromLabel("InterfaceError",false,false,false,10,10)
    endif
    set error = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00"+error+"|r"
    if GetLocalPlayer()==whichPlayer then
        call ClearTextMessages()
        call DisplayTimedTextToPlayer(whichPlayer,0.52,0.96,2,error)
        call StartSound(udg_ErrorSound)
    endif  
endfunction

Step Three:
Next you're going to find where you want your custom error message - what trigger you're going to use it for.
Then copy this:

  • YourTrigger
    • Events
    • Conditions
    • Actions
      • Set ErrorMessage = YourMessage
      • Set ErrorPlayer = YourPlayer
      • Custom script: call ErrorMessage(udg_ErrorMessage,udg_ErrorPlayer)
Step Four:
Now you're going to fill in those variables if you haven't already.

Once again;
  • ErrorMessage is the message displayed when you tell it to appear.
  • ErrorPlayer is the player that the message is shown to.

Once you have all that completed, you're done!

ADDITIONALLY
Keep in mind that the SimError is written in vJass, and Almia's tool has a complete different purpose.
I just wish it was possible to find SimError on Hive
 
Top