1. Join other hivers in a friendly concept-art contest. The contestants have to create a genie coming out of its container. We wish you the best of luck!
    Dismiss Notice
  2. The Melee Mapping Contest #4: 2v2 - Results are out! Step by to congratulate the winners!
    Dismiss Notice
  3. We're hosting the 15th Mini-Mapping Contest with YouTuber Abelhawk! The contestants are to create a custom map that uses the hidden content within Warcraft 3 or is inspired by any of the many secrets within the game.
    Dismiss Notice
  4. The 20th iteration of the Terraining Contest is upon us! Join and create exquisite Water Structures for it.
    Dismiss Notice
  5. Check out the Staff job openings thread.
    Dismiss Notice

Difficulty importing a spell

Discussion in 'Triggers & Scripts' started by SometimesZero, May 10, 2019.

  1. SometimesZero

    SometimesZero

    Joined:
    May 10, 2019
    Messages:
    5
    Resources:
    0
    Resources:
    0
    Hi everyone,

    I'm returning to the World Editor after a long leave of absence, and I'm having some difficulty orienting to all of the changes/updates. I'm attempting to import this spell into a different map: Organic Bomb v1.0.3 [vJASS][UPDATE]

    When I open the original map with the spell and run "Validate test triggers" I receive an error: "Cannot convert returned value from integer to real."

    The error is thrown on this function:

    Code (Text):
    function CrazyIvan__Shift takes real r returns real
        if ( r < 120 ) then
            return 1.25
        elseif ( r < 300 ) and ( r > 119 ) then
            return 1.5
        elseif ( r < 450 ) and ( r > 299 ) then
            return 1.75
        elseif r > 449 then
            return 2
        endif
        return 1.4
    endfunction  
    However, the original spell map allows me to test and use the spell without any issues.

    By contrast, when I then try to import the spell into a different map, I receive the same error message but am unable to even test the map.

    Any ideas why?
     
  2. Veldris

    Veldris

    Joined:
    Jul 10, 2018
    Messages:
    262
    Resources:
    0
    Resources:
    0
    Maybe the worldeditor verison is missing some features?
     
  3. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,104
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    Add a dot, to make the return number a real.
    return 2
    ->
    return 2.
    (it is basically the same as 2.0)
     
  4. SometimesZero

    SometimesZero

    Joined:
    May 10, 2019
    Messages:
    5
    Resources:
    0
    Resources:
    0
    Thank you so much! Works perfectly now.
     
  5. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    2,410
    Resources:
    0
    Resources:
    0
    For further understanding: this type of 'return bug' was supported by the WE's syntax checker until patch 1.24b where it was removed because the return bug could be exploited to run arbitrary code on your machine. Now the syntax checker is rigid about return types and makes sure you are giving it the right thing to return instead of doing so blindly.
     
  6. SometimesZero

    SometimesZero

    Joined:
    May 10, 2019
    Messages:
    5
    Resources:
    0
    Resources:
    0
    Thanks, that helps because I'm having a hard time easing back into the World Editor now that those ancient bugs, like the Return Bug, have been fixed.