RoyalFlare 发表于 2015-1-26 17:43:09

新建地图无法保存?

本帖最后由 RoyalFlare 于 2015-1-26 20:06 编辑

RT 随意创建1个新地图,写完代码以后想保存测试1下,结果YDWE就弹出提示
7118: Cannot convert returned value from real to integer
查看JassHelper的错误提示信息得到如下提示

function GetFadeFromSeconds takes real seconds returns integer
    if (seconds != 0) then
      return 128 / seconds
    else
      return 10000
    endif
endfunction

然后往上翻发现多了许多预定义的函数,猜测是YDWE自动注入地图的函数.求解答.
关闭自动注入代码的功能依旧无效.写个Library就这麽难?


RoyalFlare 发表于 2015-1-26 17:45:48

本帖最后由 RoyalFlare 于 2015-1-26 17:48 编辑


library TerrainPathability initializer Init
//******************************************************************************
//* BY: Rising_Dusk
//*
//* This script can be used to detect the type of pathing at a specific point.
//* It is valuable to do it this way because the IsTerrainPathable is very
//* counterintuitive and returns in odd ways and aren't always as you would
//* expect. This library, however, facilitates detecting those things reliably
//* and easily.
//*
//******************************************************************************
//*
//* > function IsTerrainDeepWater takes real x, real y returns boolean
//* > function IsTerrainShallowWater takes real x, real y returns boolean
//* > function IsTerrainLand takes real x, real y returns boolean
//* > function IsTerrainPlatform takes real x, real y returns boolean
//* > function IsTerrainWalkable takes real x, real y returns boolean
//*
//* These functions return true if the given point is of the type specified
//* in the function's name and false if it is not. For the IsTerrainWalkable
//* function, the MAX_RANGE constant below is the maximum deviation range from
//* the supplied coordinates that will still return true.
//*
//* The IsTerrainPlatform works for any preplaced walkable destructable. It will
//* return true over bridges, destructable ramps, elevators, and invisible
//* platforms. Walkable destructables created at runtime do not create the same
//* pathing hole as preplaced ones do, so this will return false for them. All
//* other functions except IsTerrainWalkable return false for platforms, because
//* the platform itself erases their pathing when the map is saved.
//*
//* After calling IsTerrainWalkable(x, y), the following two global variables
//* gain meaning. They return the X and Y coordinates of the nearest walkable
//* point to the specified coordinates. These will only deviate from the
//* IsTerrainWalkable function arguments if the function returned false.
//*
//* Variables that can be used from the library:
//* TerrainPathability_X
//* TerrainPathability_Y
//*
globals
    private constant real MAX_RANGE = 10.
    private constant integer DUMMY_ITEM_ID = 'wolg'
endglobals

globals
    private item Item = null
    private rect Find = null
    private item array Hid
    private integer HidMax = 0
    public real X = 0.
    public real Y = 0.
endglobals

function IsTerrainDeepWater takes real x, real y returns boolean
    return not IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY) and IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY)
endfunction
function IsTerrainShallowWater takes real x, real y returns boolean
    return not IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY) and not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY) and IsTerrainPathable(x, y, PATHING_TYPE_BUILDABILITY)
endfunction
function IsTerrainLand takes real x, real y returns boolean
    return IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY)
endfunction
function IsTerrainPlatform takes real x, real y returns boolean
    return not IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY) and not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY) and not IsTerrainPathable(x, y, PATHING_TYPE_BUILDABILITY)
endfunction

private function HideItem takes nothing returns nothing
if IsItemVisible(GetEnumItem()) then
    set Hid = GetEnumItem()
    call SetItemVisible(Hid, false)
    set HidMax = HidMax + 1
endif
endfunction
function IsTerrainWalkable takes real x, real y returns boolean
//Hide any items in the area to avoid conflicts with our item
call MoveRectTo(Find, x, y)
call EnumItemsInRect(Find ,null, function HideItem)
//Try to move the test item and get its coords
call SetItemPosition(Item, x, y) //Unhides the item
set X = GetItemX(Item)
set Y = GetItemY(Item)
static if LIBRARY_IsTerrainWalkable then
    //This is for compatibility with the IsTerrainWalkable library
    set IsTerrainWalkable_X = X
    set IsTerrainWalkable_Y = Y
endif
call SetItemVisible(Item, false)//Hide it again
//Unhide any items hidden at the start
loop
    exitwhen HidMax <= 0
    set HidMax = HidMax - 1
    call SetItemVisible(Hid, true)
    set Hid = null
endloop
//Return walkability
return (X-x)*(X-x)+(Y-y)*(Y-y) <= MAX_RANGE*MAX_RANGE and not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY)
endfunction

private function Init takes nothing returns nothing
set Find = Rect(0., 0., 128., 128.)
set Item = CreateItem(DUMMY_ITEM_ID, 0, 0)
call SetItemVisible(Item, false)
endfunction
endlibrary


任意1张空白地图写完Jass代码以后就不能保存了,这是神马疑难Bug?
教练我还要用TimerUtils,GroupUtils,Table,CheckPathAbility,Knockback呢! 函数都不能导入怎麽继续做图?
找到完整的系统却不能移植 郁闷
@希瓦 @chyj4747 @ckpig @zhuzeitou @actboy168

希瓦 发表于 2015-1-26 19:33:26



function GetFadeFromSeconds takes real seconds returns integer
    if (seconds != 0) then
      return R2I( 128 / seconds )
    else
      return 10000
    endif
endfunction


试试

RoyalFlare 发表于 2015-1-26 20:08:15

@希瓦 你下载附件试试能否正常保存? 已经把常用的Library加入进去了 地图增大了不少= =

希瓦 发表于 2015-1-26 22:26:00

RoyalFlare 发表于 2015-1-26 20:08
@希瓦 你下载附件试试能否正常保存? 已经把常用的Library加入进去了 地图增大了不少= =

没YD。。打不开

希瓦 发表于 2015-1-26 22:26:13

RoyalFlare 发表于 2015-1-26 20:08
@希瓦 你下载附件试试能否正常保存? 已经把常用的Library加入进去了 地图增大了不少= =

没YD。。打不开

ckpig 发表于 2015-2-21 18:08:04

智商问题。整数实数不分?

ckpig 发表于 2015-2-21 18:08:09

智商问题。整数实数不分?

RoyalFlare 发表于 2015-2-22 00:33:40

@ckpig 新版本的YDWE为何启用cJass编辑器的选项是灰色不可用的? 想玩cJass只能用旧版本麽
页: [1]
查看完整版本: 新建地图无法保存?