| 03-04-2006, 11:10 PM | #1 |
Im very basic at jass and i probably havent grasped some few key concepts. I placed this in the map button in the top left. It gives me a whole bunch of random compiling errors. JASS:function 002001004 takes unit u3 returns boolean if ( ( GetItemType(UnitItemInSlotBJ(u3, GetForLoopIndexA())) == ITEM_TYPE_ARTIFACT ) ) then return true endif return false endfunction function 002001 takes unit u2, item i2 returns boolean if ( not ( UnitItemInSlotBJ(u, GetForLoopIndexA()) != i ) ) then return false endif if ( not 002001004(u2) ) then return false endif return true endfunction function 007001001 takes unit u4 returns boolean if ( not ( GetItemTypeId(UnitItemInSlotBJ(u4, GetForLoopIndexA())) == udg_Corrupt_Items[GetForLoopIndexB()] ) ) then return false endif return true endfunction function Switch1 takes ability a, unit u, item i returns nothing call SetItemDroppableBJ( i, false ) set bj_forLoopAIndex = 1 set bj_forLoopAIndexEnd = 6 loop exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd if ( 002001(u,i) ) then call SetItemDroppableBJ( UnitItemInSlotBJ(u, GetForLoopIndexA()), true ) else call DoNothing( ) endif set bj_forLoopAIndex = bj_forLoopAIndex + 1 endloop set udg_Is_Switching[GetConvertedPlayerId(GetOwningPlayer(u))] = true call TriggerSleepAction( 0.75 ) set udg_Is_Switching[GetConvertedPlayerId(GetOwningPlayer(u))] = false // SOUND HERE/ BEGIN CHAOS set bj_forLoopAIndex = 1 set bj_forLoopAIndexEnd = 6 loop exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd set bj_forLoopBIndex = 1 set bj_forLoopBIndexEnd = udg_Corrupt_Amount[2] loop exitwhen bj_forLoopBIndex > bj_forLoopBIndexEnd if ( 001007001(u) ) then set udg_Temp_Give_Back_Item[GetForLoopIndexA()] = GetItemTypeId(UnitItemInSlotBJ(u, GetForLoopIndexA())) set udg_Temp_Give_Item_Slot[GetForLoopIndexA()] = GetForLoopIndexA() call RemoveItem( UnitItemInSlotBJ(GetManipulatingUnit(), GetForLoopIndexA()) ) else set udg_Temp_Give_Back_Item[GetForLoopIndexA()] = 'I021' set udg_Temp_Give_Item_Slot[GetForLoopIndexA()] = 0 endif set bj_forLoopBIndex = bj_forLoopBIndex + 1 endloop set bj_forLoopAIndex = bj_forLoopAIndex + 1 endloop set bj_forLoopAIndex = 1 set bj_forLoopAIndexEnd = udg_Corrupt_Amount[1] loop exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd call UnitRemoveBuffBJ( udg_Corrupt_Buffs[GetForLoopIndexA()], u ) set bj_forLoopAIndex = bj_forLoopAIndex + 1 endloop call TriggerSleepAction( 0.01 ) call UnitAddAbilityBJ( 'a', u ) call TriggerSleepAction( 0.01 ) set bj_forLoopAIndex = 1 set bj_forLoopAIndexEnd = 6 loop exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd call UnitAddItemByIdSwapped( udg_Temp_Give_Back_Item[GetForLoopIndexA()], u ) call UnitDropItemSlotBJ( u, GetLastCreatedItem(), udg_Temp_Give_Item_Slot[GetForLoopIndexA()] ) set bj_forLoopAIndex = bj_forLoopAIndex + 1 endloop // END CHAOS call SelectUnitForPlayerSingle( u, GetOwningPlayer(u) ) endfunction |
| 03-04-2006, 11:15 PM | #2 | |
this isn't JASS this is GUI like. Anyway I think I see ur bug function 002001 takes unit u2, item i2 returns boolean Quote:
u has not been declared or called or whatever u call it in JASS. There is no U local so it cannot be used in the script. The same for i |
| 03-04-2006, 11:16 PM | #3 |
They're not random. At least tell us on which line the first of them appears. |
| 03-04-2006, 11:39 PM | #4 |
Sorry anitarf, they seemed random to me. I fixed the thing taur pointed out and relised that functions cannot start with integers. Now, when i compile I only get 3 errors. one was "Expected a name" line 1691 if ( a001007001(u) ) then and the other 2 were "expected endloop" on lines 1695, 1698 JASS:function a002001004 takes unit u3 returns boolean if ( ( GetItemType(UnitItemInSlotBJ(u3, GetForLoopIndexA())) == ITEM_TYPE_ARTIFACT ) ) then return true endif return false endfunction function a002001 takes unit u2, item i2 returns boolean if ( not ( UnitItemInSlotBJ(u2, GetForLoopIndexA()) != i2 ) ) then return false endif if ( not a002001004(u2) ) then return false endif return true endfunction function a007001001 takes unit u4 returns boolean if ( not ( GetItemTypeId(UnitItemInSlotBJ(u4, GetForLoopIndexA())) == udg_Corrupt_Items[GetForLoopIndexB()] ) ) then return false endif return true endfunction function Switch1 takes ability a, unit u, item i returns nothing call SetItemDroppableBJ( i, false ) set bj_forLoopAIndex = 1 set bj_forLoopAIndexEnd = 6 loop exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd if ( a002001(u,i) ) then call SetItemDroppableBJ( UnitItemInSlotBJ(u, GetForLoopIndexA()), true ) else call DoNothing( ) endif set bj_forLoopAIndex = bj_forLoopAIndex + 1 endloop set udg_Is_Switching[GetConvertedPlayerId(GetOwningPlayer(u))] = true call TriggerSleepAction( 0.75 ) set udg_Is_Switching[GetConvertedPlayerId(GetOwningPlayer(u))] = false // SOUND HERE/ BEGIN CHAOS set bj_forLoopAIndex = 1 set bj_forLoopAIndexEnd = 6 loop exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd set bj_forLoopBIndex = 1 set bj_forLoopBIndexEnd = udg_Corrupt_Amount[2] loop exitwhen bj_forLoopBIndex > bj_forLoopBIndexEnd if ( a001007001(u) ) then set udg_Temp_Give_Back_Item[GetForLoopIndexA()] = GetItemTypeId(UnitItemInSlotBJ(u, GetForLoopIndexA())) set udg_Temp_Give_Item_Slot[GetForLoopIndexA()] = GetForLoopIndexA() call RemoveItem( UnitItemInSlotBJ(GetManipulatingUnit(), GetForLoopIndexA()) ) else set udg_Temp_Give_Back_Item[GetForLoopIndexA()] = 'I021' set udg_Temp_Give_Item_Slot[GetForLoopIndexA()] = 0 endif set bj_forLoopBIndex = bj_forLoopBIndex + 1 endloop set bj_forLoopAIndex = bj_forLoopAIndex + 1 endloop set bj_forLoopAIndex = 1 set bj_forLoopAIndexEnd = udg_Corrupt_Amount[1] loop exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd call UnitRemoveBuffBJ( udg_Corrupt_Buffs[GetForLoopIndexA()], u ) set bj_forLoopAIndex = bj_forLoopAIndex + 1 endloop call TriggerSleepAction( 0.01 ) call UnitAddAbilityBJ( 'a', u ) call TriggerSleepAction( 0.01 ) set bj_forLoopAIndex = 1 set bj_forLoopAIndexEnd = 6 loop exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd call UnitAddItemByIdSwapped( udg_Temp_Give_Back_Item[GetForLoopIndexA()], u ) call UnitDropItemSlotBJ( u, GetLastCreatedItem(), udg_Temp_Give_Item_Slot[GetForLoopIndexA()] ) set bj_forLoopAIndex = bj_forLoopAIndex + 1 endloop // END CHAOS call SelectUnitForPlayerSingle( u, GetOwningPlayer(u) ) endfunction |
| 03-05-2006, 12:20 AM | #5 |
you swapped 1 and 7 when calling the function. That kind of function naming sucks, IT sucks, it IS the devil, avoid that to any cost. If you are gonna give such bad names to functions at least give them short names so it at least is faster. Also the method you are using for the loop is horrible and your code seems as if it was converted from GUI. Things like that JASS:else call DoNothing( ) Give everyone the right to call it a terrible code. Don't use globals for loops. GetConvertedPlayerId is a dummy BJ function. So it is UnitItemInSlotBJ and SetItemDroppableBJ There is no excuse to be using them at all. |
