HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

"Error" Messages

12-28-2007, 01:12 PM#1
darkwulfv
Before, I used WEU's ErrorMsg function. Then I removed the WEU script since it was huge and unneeded in my map.

So from Burningice95 I got this:
Collapse 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 

It isn't mine and I don't know whose it is. Either way, it doesn't work at all. And yes, I did make a global sound variable called udg_SimError.

Can anyone spot what's wrong?
12-28-2007, 02:02 PM#2
DioD
this is caster system component.

no negative values allowed
12-28-2007, 02:05 PM#3
darkwulfv
What? Oh, the -1.00?

I didn't put that there... I don't even know what the value is FOR.

So what should I be setting it to then? I'd rather not go find caster system, download it, open it, search it, and find the 'right' way to do it.

Obviously, I'm trying to simulate an error message, and I really don't know the x/y values of the screen...
12-28-2007, 03:07 PM#4
DioD
y\x

0.0\1.0_______________1.0\1.0


0.0\0.0___0.52\0.0_____1.0\0.0

-1.00 outside screen
12-28-2007, 03:39 PM#5
darkwulfv
Ok... But I get a really bad error message (haha, pun) when trying to use it, from War3err.

Approximate quote: "Undeclared variable udg_SimError used in function SimError(12487458, (the string)), in function {function}"

I don't entirely know why. I changed -1.00 to .25 though.
12-28-2007, 03:58 PM#6
Ammorth
create a variable called udg_SimError.
12-28-2007, 04:33 PM#7
darkwulfv
Quote:
Originally Posted by Me
And yes, I did make a global sound variable called udg_SimError.

Read first.

Anyways, I'm going to try putting it in the header instead of in a library, see what that does.
12-28-2007, 04:48 PM#8
zen87
Collapse JASS:
function CS_Error takes player ForPlayer, string msg returns nothing
     local sound error=CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
        if (GetLocalPlayer() == ForPlayer) then
            if (msg!="") and (msg!=null) then
                call ClearTextMessages()
                call DisplayTimedTextToPlayer( ForPlayer, 0.52, -1.00, 2.00, "|cffffcc00"+msg+"|r" )
            endif
            call StartSound( error )
        endif
     call KillSoundWhenDone( error)
     set error=null
    endfunction

from caster system, hope it helps
12-28-2007, 04:59 PM#9
darkwulfv
Except that also uses a negative value for the screen.

However, I'll try that too (and fix the number)
12-28-2007, 10:07 PM#10
burningice95
It's by Vexorian
12-29-2007, 04:23 PM#11
DioD
this is old leacking version
12-30-2007, 12:08 AM#12
burningice95
really, what leaks?
12-30-2007, 02:16 PM#13
Alexander244
Here is the version I use:
Collapse JASS:
library SimError

globals
    private sound SimErrorSound = null
endglobals

function SimError takes player ForPlayer, string msg returns nothing
    if SimErrorSound == null then
        set SimErrorSound = CreateSoundFromLabel("InterfaceError", false, false, false, 10, 10)
    endif

    if (GetLocalPlayer() == ForPlayer) then
        call ClearTextMessages()
        call DisplayTimedTextToPlayer(ForPlayer, 0.51, 0.96, 2.00, "|cffffcc00\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"+msg+"|r")
        call StartSound(SimErrorSound)
    endif
endfunction

endlibrary

Based on Vexorians, new x/y and "\n\n\n\n..." by DioD (I think) as they put the error closer to where it should be.
12-30-2007, 02:59 PM#14
darkwulfv
What exactly does that \n\n\n\n\n\n\n\ thing do? I swiped it and added it to the CS_Error function though, since they're pretty much exactly alike.
12-30-2007, 03:06 PM#15
Alexander244
\n is line break.

Edit:
You shouldn't use CS_Error; memory is leaked by a sound even after KillSoundWhenDone is called upon it.