"My map worked on westfall but not on 1.24"

T.s.e

Wish I was old and a little sentimental
Reaction score
133
This is the code for testing H2I with DoNothing():
JASS:
function H2I takes handle h returns integer
return h
call DoNothing()
return 0
endfunction

function Trig_H2ITest_Actions takes nothing returns nothing
local unit u = CreateUnit(Player(0), 'hfoo', 0,0,270)
call BJDebugMsg("H2I         : " + I2S(H2I(u)))
call BJDebugMsg("GetHandleID : " + I2S(GetHandleId(u)))
set u= null
endfunction

//===========================================================================
function InitTrig_H2ITest takes nothing returns nothing
    set gg_trg_H2ITest = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_H2ITest, 5 )
    call TriggerAddAction( gg_trg_H2ITest, function Trig_H2ITest_Actions )
endfunction
 

Sevion

The DIY Ninja
Reaction score
413
i didn't know there were 10000 resources , i fixed my map, though it still doesn't completely work, but blizzard needs to simply make the compiler look at all return statements, and see if they return the correct type, wouldn't that work better?

Why would there need to be exactly 10k resources for 99.99%?
 

Frozenhelfir

set Gwypaas = Guhveepaws
Reaction score
56
99.99% != 10000

... fail math?

if you have 100 resources and one breaks, 99% still work.
if you have 1000 resources and one breaks, 99.9% still work.
if you have 10000 resources and one breaks, 99.99% still work.

You need to have 10,000 or more resources to accurately say 99.99%. He was being a smarta$$ but you still failed at math...
 

Frozenhelfir

set Gwypaas = Guhveepaws
Reaction score
56
[del]i didn't know there were 10000 resources , [/del]i fixed my map, though it still doesn't completely work, but blizzard needs to simply make the compiler look at all return statements, and see if they return the correct type, wouldn't that work better?

The blizzard compiler does do that, NewGens does not. :p

I was saying he thought it was 9,999.

I don't recall him ever saying that. He was saying that you need at least 10,000 to be able to use .0X%'s
 

Jesus4Lyf

Good Idea™
Reaction score
397
>blizzard needs to simply make the compiler look at all return statements, and see if they return the correct type
The blizzard compiler does do that
Do you not know about the return bug? or...

The WC3 JASS compiler does not check each return type. We're not talking about the default World Editor syntax checker, but WC3's internal compiler.
 

Frozenhelfir

set Gwypaas = Guhveepaws
Reaction score
56
Yea, I misread that. I thought he was looking for his last few if statements that don't return on the last else/elseif. The blizzard compiler finds those even though they aren't a bug :|
 

MasterOfRa

New Member
Reaction score
10
i know newgen doesn't, and blizzard did not do it the way i said, because if they did, the return bug wouldn't be still possible like this....

JASS:
function H2I takes handle h returns integer
return h
call DoNothing()
return 0
endfunction

if they did it my way, it would look at the return h and say that that isnt a integer, and it wouldn't work. they did it differently, and it mest up alot of maps because of the if elseif return bug that makes this not work
JASS:
if true then
    return true
elseif true
endif
return true

Also, i was already saying that for there to be 99.99% of them not working, there would have to be a multiple of 10000, (not 9999, look at the coma) I was being sarcastic...
Do you not know about the return bug? or...

The WC3 JASS compiler does not check each return type. We're not talking about the default World Editor syntax checker, but WC3's internal compiler.
The blizzard compiler does do that, NewGens does not. :p
I was talking about WC3's internal compiler anyway... newgen still doesn't have a problem with you useing the return bug, and it doesn't need to until they fix the bug completely
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
Another update, If you use a return in ANY of the IF BLOCKS OR ELSEIF BLOCKS (excluding the last ELSEIF block) then the last ELSEIF must return.

JASS:
function Hi takes integer i returns real  // DOES NOT WORK
    local real r
    if i > 1 then
        set r = 5
    elseif i > 2 then
        set r = 6.
        return r
    elseif i > 3 then
        set r = 6.
    elseif i > 4 then
        set r = 7.
    endif
    return 0.
endfunction


JASS:
function Hi takes integer i returns real  // WORKS
    local real r
    if i > 1 then
        set r = 5
    elseif i > 2 then
        set r = 6.
        return r
    elseif i > 3 then
        set r = 6.
    elseif i > 4 then
        set r = 7.
        return r
    endif
    return 0.
endfunction


BTW: these only show what will LOAD the map, it will still probably Critical error after map loads.

So wait, if i've understood all your tests, test if the map is loading is not enough ?
We have to test the code if it doesn't crash war3 when it is executed ?!

Also i just want to point out that you need to test it with debug mode "on" and "off" (ofc if you use vJass), because sometimes it does matter.
.
 

cleeezzz

The Undead Ranger.
Reaction score
268
exactly so theres no point of even trying to fix it by returning in the last endif,

separate them into 2 separate IFs and use a local boolean if you must.
 

Romek

Super Moderator
Reaction score
964
More retarded stuff:
JASS:
   // Works:
        if not <condition> then
            set u = null
           // return false
        else
            set bool = false
            call function()
        endif

   // Works:
        if not <condition> then
            set u = null
            return false
        endif
        if <same condition> then
            set bool = false
            call function()
        endif

   // Doesn't Load Map:
        if not <condition> then
            set u = null
            return false
        else
            set bool = false
            call function()
        endif


JASS:
   // Works:
    function Test takes nothing returns boolean
        local unit u = null
        if false then
            set u = null
            return false
        else
        endif
        return false
    endfunction


    // Crashes:
    function Test takes nothing returns boolean
        local unit u = null
        if false then
            set u = null
            return false
        else
            set u = null
        endif
        return false
    endfunction


The first set of stuff was taken from a script I'm working on, with the condition replaced and stuff. So the result could be caused by something similar to that.

The second was me testing to find the cause of the first.

Edit:
JASS:
// Crash:
   function Test takes nothing returns boolean
        local unit u
        if true then
            return false
        else
            set u = null
        endif
        return false
    endfunction

// Work:
   function Test takes nothing returns boolean
        local unit u
        if true then
            return false
        else
            //set u = null
        endif
        return false
    endfunction
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
My general rule:

If you return in an "if" statement, follow it immediately with "endif". There's no point in using an "else" anyway, just costs more lines of code. Everything after the "endif" is "else" anyway.

So for that reason, I'm glad for this bug. :)
Seems enough fair if it is true in all cases, is it ?

Also yes there is no point of using else but elseif save one line code (no endif) xD
And yes i know the bytecode should be exactly the same.
 

SerraAvenger

Cuz I can
Reaction score
234
can anyone explain to me why this function doesn't load?

JASS:
function GetClosestUnitInRange takes real x, real y, real radius, boolean closest, boolexpr filter returns unit
    local group g = GLOBAL_GROUP
    local unit curUnit = null
    local unit loopUnit
    local real curDist
    local real dX
    local real dY
    local real loopDist
    call GroupClear( g )
    call GroupEnumUnitsInRange( g, x, y, radius, filter )
    if closest then
        set curDist = radius + 1
    else
        set curDist = 0
    endif
    loop
        set loopUnit = FirstOfGroup( g )
        exitwhen loopUnit == null
        set dX = x - GetUnitX( loopUnit )
        set dY = y - GetUnitY( loopUnit )
        set loopDist = SquareRoot( dX * dX + dY * dY )
        if loopDist < curDist == closest then
            set curDist = loopDist
            set curUnit = loopUnit
        endif
        call GroupRemoveUnit( g, loopUnit )
    endloop
    set ReturnHandle = curUnit
    set filter = null
    set loopUnit = null
    set curUnit = null
    return ReturnHandle
endfunction
 

SerraAvenger

Cuz I can
Reaction score
234
serra i dont see anything wrong with that trigger, are you sure its that code?

yes, I commented it out and the map loaded.
If I have the function in the map, it doesn't even show the correct player slots in the lobby when selecting it in single player.

I don't see anything wrong with it either...

Thanks for your comments, Serra
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top