HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

SimError

09-25-2007, 04:42 PM#1
cohadar
Can someone pass me the SimError trigger,
I lost my .j file with it and I cannot find it anywhere now...
09-25-2007, 04:50 PM#2
Alexander244
Link
09-25-2007, 05:03 PM#3
cohadar
There are so many resources on war3 that I will soon forget where I put my own stuff.

Thank you.
09-25-2007, 06:15 PM#4
DioD
function TrueSimError takes player p, string msg returns nothing
local sound error=CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
if (GetLocalPlayer() == p) then
if (msg!="") and (msg!=null) then
//call ClearTextMessages()
call DisplayTimedTextToPlayer( p, 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" )
endif
call StartSound( error )
endif
call KillSoundWhenDone( error)
set error=null
endfunction

Litle more coding by me to place text right at place
09-25-2007, 06:57 PM#5
cohadar
learn to use jass tags ffs.
Collapse JASS:
function TrueSimError takes player p, string msg returns nothing
    local sound error=CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
    if (GetLocalPlayer() == p) then
        if (msg!="") and (msg!=null) then
            //call ClearTextMessages()
            call DisplayTimedTextToPlayer( p, 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" )
        endif
        call StartSound( error )
    endif
    call KillSoundWhenDone( error)
    set error=null
endfunction

This code is a lol.
Learn to use globals also.
09-25-2007, 07:12 PM#6
Silvenon
I don't understand the your code DioD, is it better then Vexorian's or were you joking?

Anyways, I like this one:

Collapse JASS:
scope MySimError

globals
    private sound udg_SimError = null
endglobals

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

endscope


This way you don't have to create the SimError global, which I btw always forget :)

EDIT: Though your function has a msg if/then/else which is useful.

I asked this somewhere else, but I can't remember where.......How can a string be null? Why does it have a GetLocalPlayer() if/then/else if DisplayTimedTextToPlayer already has that?
09-25-2007, 07:28 PM#7
Alexander244
The location of the message with the '\n' trick depends on screen resolution, so it's not a good solution.
09-25-2007, 08:05 PM#8
Toadcop
sim errors are for lamers xD no one needs blizz shity stuff =) it's just so btw

Quote:
depends on screen resolution
hmmm strange =) it must be tested again...
09-25-2007, 09:28 PM#9
cohadar
Quote:
Originally Posted by Toadcop
hmmm strange =) it must be tested again...


ahahahahahahhahahahahaha, you so totally called yourself a lamer with that last line.
09-26-2007, 07:34 AM#10
DioD
Well same happened here, just test code ingame it shows text right at place.
09-26-2007, 09:44 AM#11
Silvenon
So Vex's one is not right then?
09-26-2007, 10:07 AM#12
cohadar
Quote:
Originally Posted by Silvenon
So Vex's one is not right then?

Of course it is right, it is even more optimized that others.
On the other hand if you don't like using udg_ globals you could simply do this:
Collapse JASS:
scope SimError
// small modification of Vexorians SimError
// only replaced udg_SimError with SimErrorSound so you don't have to use udg_'s
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.52, -1.00, 2.00, "|cffffcc00"+msg+"|r" )
        call StartSound( SimErrorSound )
    endif
endfunction

endscope

09-26-2007, 04:37 PM#13
Alexander244
Was thinking about the other '\n' trick, for displaying inside the interface... for sim error DioD's is the best method, and should work fine.

Collapse sim error:
scope 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.52, 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

endscope
09-26-2007, 04:54 PM#14
cohadar
Credits to Vexorian, DioD, Cohadar and Alexander244.

If you use this in your map you must pay each of us 1$ for every player that ever plays your map.
09-26-2007, 05:10 PM#15
Toadcop
Quote:
depends on screen resolution

hmmm strange =) it must be tested again...

you so totally called yourself a lamer with that last line.
i simpled meaned what in war3 all is in proportions from 0-1 so that makes no sense what it will be different on different resolutions =) + DioD pawnz you are sucking. just funny to read this posts...