HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Easy ways to crash the WE (watch out for)

10-25-2003, 11:18 AM#1
Grater
Create a trigger with the only action:

Custom script: if (true==true) then

or

Custom script: loop

It crashes the world editor on saving (for me)
(un)cool huh?

Know of any other simple script errors that causes a crash?
10-25-2003, 11:26 AM#2
PitzerMike
I guess any statement that is only valid in conjunction with other statements will crash WE, if the other statements are missing.
10-25-2003, 11:45 AM#3
KaTTaNa
Making a function without a return statement will crash the WE unless the function returns nothing.
For example:
Code:
function Crash takes nothing returns integer

endfunction
10-25-2003, 02:22 PM#4
Grater
Ouch! Thats terrible, return statements are exactly the kind of thing I'm liable to forget.
10-25-2003, 02:35 PM#5
KaTTaNa
Yes, me too.
A good idea is to turn on autosave because that doesn't check the syntax, it just saves without approving anything in the map.
10-25-2003, 04:01 PM#6
PitzerMike
Turning on autosave is not only good, in my opinion it's more bad. For example if you convert a trigger to JASS just to see a piece of code and then it saves ....
10-25-2003, 07:51 PM#7
Cacodemon
Another way to crush WE - write condition with loop within it. For example if this function going to be used as trigger's condition, it will crush WE:

Code:
function CrushCondition takes nothing returns boolean
 loop
  exitwhen ...
  // loop actions here...
 endloop
endfunction
return ...
endfunction

This bug may be used as map protection - if Warcraft will not crush itself, we can use these condition to prevent WE from saving (maybe reading?) protected map.
10-26-2003, 06:58 AM#8
PitzerMike
Cocodemon: It's not the loop that crashes WE. I used a ton of loops also in condition functions.
It's that you end the function before returning the required boolean.
And it would also not work in game.
10-26-2003, 12:36 PM#9
Cacodemon
Opps! That endfunctionwas just a mistake :) So can you explain me why my WE 1.07 crashed every time I use loops in conditions?
10-26-2003, 02:07 PM#10
PitzerMike
dunno. maybe you can post an exact example.
for me it works
10-26-2003, 02:17 PM#11
KaTTaNa
It happens if you have a return value inside the loop.
For example, stuff like this can cause problems:
Code:
function Conditions takes nothing returns boolean
    local integer i = 0
    loop
        exitwhen i > 15

        if i == 8 then
            return true
        endif

        set i = i + 1
    endloop
endfunction
Because the only return statement is inside the loop. The problem can be fixed by placing a return statement at the end even though you know it will never get executed.
10-27-2003, 01:12 AM#12
Cacodemon
You are right! My WE seems to crush because of that!
10-27-2003, 11:11 AM#13
KaTTaNa
Oh, and missing parameters can sometimes crash the WE.
For example, this crashed my WE yesterday :nono:
Code:
call SetUnitFlyHeight( GetEnumUnit(), 600.0 )
Because I forgot the last parameter (which is 'rate')

I'm not sure if it will crash the WE in ever case, I think it depends on what the following statement is.
10-27-2003, 12:38 PM#14
Cacodemon
Another way to crush Warcraft, _not_ WE is to create function which returns taken handle. For example:

Code:
[color=orange]
function Crush takes location Loc returns location
 return Loc
endfunction
[/color]

For example, call Crush(Location(0,0)) will cause Warcraft crush.
10-27-2003, 12:57 PM#15
Vexorian
Are you sure?

I have a lot of functions that do that in my map (for my system) and I never got a crash