1.24 sytem conversion

Sui-cookie

You can change this now in User CP.
Reaction score
49
i need some help converting this to be compatible with the new patch. Ive contacted the maker and he cant figure it out. PLLZ needs halp..thx :)

JASS:
library MultiboardInventory initializer Init

// The_Witcher's Multiboard Equipment and Inventory System
//
//This is a MUI/MPI inventory-in-a-multiboard-system.
//it allows you to add an inventory to any unit
//the inventory has a part for equipment and a part for a "normal" inventory
//you can register items for this system (unregistered ones won't move inside the inventory),
//check whether a unit has a item of type xy in its inventory, force dropping of an item of type,
//directly remove a item of type xy from the iventory from the game or check whether a itemtype is already registered
//
// when you give a unit a inventory it will only open when you cast the open ability. you can navigate with the arrow keys.
// items with charges will stack automatically. to add an item right click on it and the right click again on the "Inventory" item.
// when autoadd is enabled all pickuped items which are registered will be added automatically
//
// here are the included functions:
//
// 1.to give a unit the inventory use
//
// call InitInventory(ToWhichUnit)
// unit
//
// 2.To get rid of a inventory just use
// call DestroyInventory( which unit's)
// unit
//
// 3.to register an item for this system use(if the item shouldn't be equipable enter 0 for UsedSlotWhenEquipment. the abilities can be 0 then, too.)
// call RegisterItem(itemid, ItemDescription, PathToIcon, ability1, ability2, ability3, UsedSlotWhenEquipment)
// integer string string integer integer integer integer
//
// 4.to check whether you have an item already registered use(it will return true or false)
// call IsItemRegistered(itemid)
// integer
//
// 5.to force dropping of a item use (it will drop the first found item of that type)
// call DropItemById(fromWhich, itemid)
// unit integer
//
// 6.to remove an item directly use ( it will remove the first found item of that type)
// call RemoveItemById(FromWhichUnit, itemid)
// unit integer
//
// 7.to check whether a unit has an item of type xy use
// call UnitHasItemOfId(WhichUnit, itemid)
// unit integer
//
// 8.to change the description of a registered itemtype use
// call ChangeItemDescription(itemid, newdescription)
// integer string
//
// to implement this system, just copy this trigger in your map
// it requires jngp to be edited/saved
//
// have fun^^
//
//--------------------------------
//--------The SETUP PART----------
//--------------------------------

globals
    private constant integer openabi = 'A000' // the ability to open/close the inventory
    private constant integer dropabi = 'A002' // the ability to drop the selected item to the normal inventory
    private constant integer equipabi = 'A003' // the ability to equip the selected item
    private constant integer autoadd = 'A005' // the ability to enable/disable autoadd
    private constant integer inventitem = 'I000' // the rawsode of the invetory item you use to add single items
    private constant string emptyslot = "[------]" // the text shown when a slot is not used
    private constant string NewLine = "PP" // the text used in the description to show the parser that he should start a new line (\n will NOT work)
    private constant string name = "|cff0863B5" // the colorcode of the Name of the selected item in the info part
    private constant string description = "|cff08B5FF" // the colorcode of the description of the selected item in the info part
    private constant string help = "|cffE62929" // the colorcode of the help texts
    private constant string titles = "|cffFFCC00" // the colorcode of the names of the cathegories
    private constant integer classes = 8 // the amount of different classes you have for equipable items

                        //make sure that you synch the following hotkey variables with the hotkeys of the abilities in the object editor
    private constant string HotkeyExit = "O" // the hotkey for opening/closing the multiboard inventory
    private constant string HotkeyDrop = "D" // the hotkey for dropping an item
    private constant string HotkeyEquip = "E" // the hotkey for equiping/unequiping an item
    private constant string HotkeyAutoadd = "T" // the hotkey for Enabling/Disabling the AutoAdd feature

    private string array EquipName // ignore this one here
endglobals

private function InitItems takes nothing returns nothing // use this function to register all the items you want to be registered from the start
    // potion
    call RegisterItem.evaluate('phea',"Heals very good, and is very healthy...","ReplaceableTextures\\CommandButtons\\BTNPotionGreenSmall.blp",0,0,0,0)
    // clear vision
    call RegisterItem.evaluate('plcl',"For clear vision.PPEnables best underwaterview ever seen.PPAlso is very userfriendly!!!","ReplaceableTextures\\CommandButtons\\BTNLesserClarityPotion.blp",0,0,0,0)
    // sword
    call RegisterItem.evaluate('I001',"This is just a normal sword!PP PPType: Mainhand.PPAdds 5 Damage.","ReplaceableTextures\\CommandButtons\\BTNDaggerOfEscape.blp",'A004',0,0,2)
    // big sword
    call RegisterItem.evaluate('I002',"This sword is very huge!PPIt deals epic damage!!PP PPType: Mainhand.PPAdds 20 Damage.","ReplaceableTextures\\CommandButtons\\BTNArcaniteMelee.blp",'A006',0,0,2)
    // big shield
    call RegisterItem.evaluate('I003',"A heavy shield. Helping even against strong blows.PP PPType: Offhand.PPAdds 10 Armor.","ReplaceableTextures\\CommandButtons\\BTNHumanArmorUpThree.blp",'A007',0,0,3)
    // shield
    call RegisterItem.evaluate('I004',"A small shield. Helps only against light blows.PP PPType: Offhand.PPAdds 3 Armor.","ReplaceableTextures\\CommandButtons\\BTNHumanArmorUpOne.blp",'A008',0,0,3)
    // cursed armor
    call RegisterItem.evaluate('I005',"This Armor is cursed and will help you, boosting your defendive and offensive skillsPP PPType: Armor.PPAdds 3 Armor and 4 damage.","ReplaceableTextures\\CommandButtons\\BTNMoonArmor.blp",'A009','A00A',0,4)
    // special box
    call RegisterItem.evaluate(&#039;I006&#039;,&quot;Huh? A small box with a paper in it<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite7" alt=":p" title="Stick Out Tongue    :p" loading="lazy" data-shortname=":p" />P PPThis System is created by The_Witcher!!&quot;,&quot;ReplaceableTextures\\CommandButtons\\BTNBox.blp&quot;,0,0,0,8)
endfunction

private function InitEquipment takes nothing returns nothing // use this function to set up the names of the equipment slots
    set EquipName[1] = &quot;[Helmet]&quot;
    set EquipName[2] = &quot;[Mainhand]&quot;
    set EquipName[3] = &quot;[Offhand]&quot;
    set EquipName[4] = &quot;[Armor]&quot;
    set EquipName[5] = &quot;[Boots]&quot;
    set EquipName[6] = &quot;[Gloves]&quot;
    set EquipName[7] = &quot;[Amulet]&quot;
    set EquipName[8] = &quot;[Special]&quot;
endfunction

//--------------------------------
//---------END OF SETUP-----------
//--------------------------------

globals
    private integer items = 1
    private integer array itemm
    private string array text
    private string array iconpath
private integer array abi1
    private integer array abi2
    private integer array abi3
    private integer array slot
    private integer array x
    private integer array y
    private group g = CreateGroup()
    private multiboard array board
    private unit array t
    private integer maxchars = 35
endglobals

function RegisterItem takes integer itemid, string description, string path, integer abil1, integer abil2, integer abil3, integer slott returns nothing
    set itemm[items] = itemid
    set text[items] = description
    set iconpath[items] = path
    set abi1[items] = abil1
    set abi2[items] = abil2
    set abi3[items] = abil3
    set slot[items] = slott + 1
    set items = items + 1
endfunction

private function GetItemIndex takes item ite returns integer
local integer i = 0
    local integer id = GetItemTypeId(ite)
    loop
        exitwhen i &gt;= items
        if itemm<i> == id then
            return i
        endif
        set i = i + 1
    endloop
    return 0
endfunction

function ChangeItemDescription takes integer itemid, string newdescr returns nothing
    local integer i = 0
    loop
        exitwhen i &gt;= items
        if itemm<i> == itemid then
            set text<i> = newdescr
            return
        endif
        set i = i + 1
    endloop
endfunction

private keyword UpdateDescription
private keyword GetData

private struct data
    unit u
    multiboard m
    integer lu = 1
    item invent
    boolean auto = false
    integer array stack[99]
    integer array slot2index[99]

method AddItem takes item which returns nothing
    local integer i = GetItemIndex(which)
    local integer a = 0
    local boolean b
    if which == null then
        return
    endif
    loop
        exitwhen a &gt; .lu
        if itemm[.slot2index[a]] == GetItemTypeId(which) and GetItemCharges(which)!= 0 and .stack[a] &lt; 99 then
            set .stack[a] = .stack[a] + GetItemCharges(which)
            call MultiboardSetItemValueBJ( .m, 4, a, I2S(.stack[a]) )
            call RemoveItem(which)
            return
        endif
        set a = a + 1
    endloop
    if .lu != 28 then
        set .lu = .lu + 1
        set .slot2index[.lu] = i
        set .stack[.lu] = GetItemCharges(which)
        call MultiboardSetItemStyleBJ( .m, 3, .lu, true, true )
        call MultiboardSetItemIconBJ( .m, 3, .lu, iconpath<i> )
        call MultiboardSetItemValueBJ( .m, 3, .lu, GetItemName(which) )
        if .stack[.lu]!= 0 then
            call MultiboardSetItemValueBJ( .m, 4, .lu, I2S(.stack[.lu]) )
        endif
        call RemoveItem(which)
    endif
    call UpdateDescription.evaluate(GetPlayerId(GetOwningPlayer(.u)))
endmethod

method RemoveItem takes integer i returns nothing
    local integer k = y<i>
    local item ite
    if (x<i> == 3 and k &gt; .lu) or (x<i> == 1 and .slot2index[k+28] == 0)then
        return
    endif
    if x<i> == 1 then
        call UnitRemoveAbility(.u,abi1[.slot2index[k+28]])
        call UnitRemoveAbility(.u,abi2[.slot2index[k+28]])
        call UnitRemoveAbility(.u,abi3[.slot2index[k+28]])
        set .slot2index[k+28] = 0
        call MultiboardSetItemValueBJ( .m, 1, k, EquipName[k-1] )
        call MultiboardSetItemStyleBJ( .m, 1, k, true, false )
    else
        loop
            call MultiboardSetItemIconBJ( .m, 3, k, iconpath[.slot2index[k+1]] )
            set ite = CreateItem(itemm[.slot2index[k+1]],0,0)
            call MultiboardSetItemValueBJ( .m, 3, k, GetItemName(ite) )
            if .stack[k+1]!= 0 then
                call MultiboardSetItemValueBJ( .m, 4, k, I2S(.stack[k+1]) )
            else
                call MultiboardSetItemValueBJ( .m, 4, k, &quot;&quot; )
            endif
            set .stack[k] = .stack[k+1]
            call RemoveItem(ite)
            set .slot2index[k] = .slot2index[k+1]
            exitwhen k == .lu
            set k = k + 1
        endloop
        call MultiboardSetItemStyleBJ( .m, 3, .lu, true, false )
        call MultiboardSetItemValueBJ( .m, 3, .lu, emptyslot )
        call MultiboardSetItemValueBJ( .m, 4, .lu, &quot;&quot; )
        set .slot2index[.lu] = 0
        set .stack[.lu] = 0
        set .lu = .lu - 1
    endif
    call UpdateDescription.evaluate(i)
    set ite = null
endmethod

method Unequip takes integer i,integer slot returns nothing
    local integer k = slot
    local item ite
    if itemm[.slot2index[k+28]] == 0 then
        return
    endif
    set ite = CreateItem(itemm[.slot2index[k+28]],0,0)
    call .AddItem(ite)
    call UnitRemoveAbility(.u,abi1[.slot2index[k+28]])
    call UnitRemoveAbility(.u,abi2[.slot2index[k+28]])
    call UnitRemoveAbility(.u,abi3[.slot2index[k+28]])
    set .slot2index[k+28] = 0
    call MultiboardSetItemValueBJ( .m, 1, k, EquipName[k-1] )
    call MultiboardSetItemStyleBJ( .m, 1, k, true, false )
    call UpdateDescription.evaluate(i)
    set ite = null
endmethod

method Equip takes integer i returns nothing
    local integer k = y<i>
    local item ite
    if k &gt; .lu or slot[.slot2index[k]] == 1 then
        return
    endif
    if .slot2index[slot[.slot2index[k]]+28] != 0 then
        call .Unequip(i,slot[.slot2index[k]])
    endif
    set .slot2index[slot[.slot2index[k]]+28] = .slot2index[k]
    set ite = CreateItem(itemm[.slot2index[k]],0,0)
    call MultiboardSetItemValueBJ( .m, 1, slot[.slot2index[k]], GetItemName(ite) )
    call MultiboardSetItemIconBJ( .m, 1, slot[.slot2index[k]], iconpath[.slot2index[k]] )
    call MultiboardSetItemStyleBJ( .m, 1, slot[.slot2index[k]], true, true )
    call RemoveItem(ite)
    call UnitAddAbility(.u,abi1[.slot2index[k]])
    call UnitAddAbility(.u,abi2[.slot2index[k]])
    call UnitAddAbility(.u,abi3[.slot2index[k]])
    call .RemoveItem(i)
    call UpdateDescription.evaluate(i)
    set ite = null
endmethod

endstruct

private function ParseString takes string toparse, integer i returns nothing
    local integer s = 0
    local integer line = 0
    local integer linestart = 0
    local integer spacepoint = 0
    local boolean next = false
    loop
        exitwhen s &gt; 28
        call MultiboardSetItemValueBJ( board<i>, 2, 9+s, &quot;&quot;)
        set s = s+ 1
    endloop
    set s = 0
    loop
        exitwhen linestart+s &gt; StringLength(toparse)
        set s = s+1
        if SubString(toparse,linestart+s-1,linestart+s) == &quot; &quot; then
            set spacepoint = linestart+s
        endif
        if SubString(toparse,linestart+s-StringLength(NewLine),linestart+s) == NewLine then
            set spacepoint = linestart+s-StringLength(NewLine)
            set s = maxchars
            set next = true
        endif
        if s &gt;= maxchars then
            call MultiboardSetItemValueBJ( board<i>, 2, 9+line, description + SubString(toparse,linestart,spacepoint ) + &quot;|r&quot; )
            set linestart = spacepoint
            set spacepoint = linestart
            set s = 0
            set line = line + 1
            if next then
                set next = false
                set linestart = linestart + StringLength(NewLine)
            endif
        endif
    endloop
    call MultiboardSetItemValueBJ( board<i>, 2, 9+line, description + SubString(toparse,linestart,StringLength(toparse) ) + &quot;|r&quot; )
endfunction

globals
    private data array DATAS
    private integer total = 0
endglobals

private function GetData takes unit u returns data
    local data dat
local integer i = 0
    loop
        exitwhen i &gt; total
        set dat = DATAS<i>
        if dat.u == u then
            return dat
        endif
        set i = i + 1
    endloop
    return 0
endfunction

function IsItemRegistered takes integer itemid returns boolean
     local integer i = 0
     loop
         exitwhen i &gt; items
         if itemm<i> == itemid then
             return true
         endif
         set i = i+1
     endloop
     return false
endfunction

private function UpdateDescription takes integer i returns nothing
    local item ite
    local integer a = 2
    local data dat = GetData(t<i>)
    if dat == 0 then
    return
    endif
    if x<i> == 1 then
        set ite = CreateItem(itemm[dat.slot2index[y<i> + 28]],0,0)
        call MultiboardSetItemValueBJ( dat.m, 2, 8, name + GetItemName(ite) + &quot;|r&quot; )
        call RemoveItem(ite)
        call ParseString(text[dat.slot2index[y<i> + 28]],i)
    else
        set ite = CreateItem(itemm[dat.slot2index[y<i>]],0,0)
        call MultiboardSetItemValueBJ( dat.m, 2, 8, name + GetItemName(ite) + &quot;|r&quot; )
        call RemoveItem(ite)
        call ParseString(text[dat.slot2index[y<i>]],i)
    endif
    loop
        exitwhen a &gt; 28
        if dat.slot2index[a] != 0 then
            call MultiboardSetItemColorBJ(dat.m,3,a,100,100,100,0)
            call MultiboardSetItemColorBJ(dat.m,4,a,100,100,100,0)
        else
            call MultiboardSetItemColorBJ(dat.m,3,a,50,50,50,0)
            call MultiboardSetItemColorBJ(dat.m,4,a,50,50,50,0)
        endif
        set a = a + 1
    endloop
    set a = 30
    loop
        exitwhen a &gt; 56
        if dat.slot2index[a] != 0 then
            call MultiboardSetItemColorBJ(dat.m,1,a-28,100,100,100,0)
        else
            call MultiboardSetItemColorBJ(dat.m,1,a-28,50,50,50,0)
endif
        set a = a + 1
    endloop
    if x<i> == 1 then
        call MultiboardSetItemColorBJ( dat.m, 1, y<i>, 10, 100, 10, 0 )
    else
        call MultiboardSetItemColorBJ( dat.m, 3, y<i>, 10, 100, 10, 0 )
        call MultiboardSetItemColorBJ( dat.m, 4, y<i>, 10, 100, 10, 0 )
    endif
    set ite = null
endfunction

function InitInventory takes unit u returns nothing
    local integer i = 2
    local data dat = data.create()
    set dat.u = u
    set dat.m = CreateMultiboardBJ(4,30,&quot;Inventory&quot;)
    call MultiboardSetItemWidthBJ( dat.m, 1, 0, 25 )
    call MultiboardSetItemWidthBJ( dat.m, 2, 0, 22 )
    call MultiboardSetItemWidthBJ( dat.m, 3, 0, 25 )
    call MultiboardSetItemWidthBJ( dat.m, 4, 0, 8 )
    call MultiboardSetItemStyleBJ( dat.m, 0, 0, true, false )
    call MultiboardSetItemValueBJ( dat.m, 3, 0, emptyslot )
    call MultiboardSetItemValueBJ( dat.m, 3, 29, &quot;&quot; )
    call MultiboardSetItemValueBJ( dat.m, 3, 30, &quot;&quot; )
    call MultiboardSetItemValueBJ( dat.m, 3, 1, titles + &quot;INVENTORY&quot; + &quot;|r&quot;)
    call MultiboardSetItemValueBJ( dat.m, 1, 1, titles + &quot;EQUIPMENT&quot; + &quot;|r&quot;)
    call MultiboardSetItemValueBJ( dat.m, 2, 7, titles + &quot;INFO&quot; + &quot;|r&quot; )
    call MultiboardSetItemValueBJ( dat.m, 2, 1, titles + &quot;HELP&quot; + &quot;|r&quot; )
    call MultiboardSetItemValueBJ( dat.m, 4, 1, titles + &quot;CHARGES&quot; + &quot;|r&quot; )
    call MultiboardSetItemValueBJ( dat.m, 2, 2, help + HotkeyExit +&quot; = Exit&quot; + &quot;|r&quot;)
    call MultiboardSetItemValueBJ( dat.m, 2, 3, help + HotkeyDrop +&quot; = Drop to normal Inventory&quot; + &quot;|r&quot;)
    call MultiboardSetItemValueBJ( dat.m, 2, 4, help + HotkeyEquip +&quot; = Equip/Unequip&quot; + &quot;|r&quot;)
    call MultiboardSetItemValueBJ( dat.m, 2, 5, help + HotkeyAutoadd +&quot; = AutoPickup ON/OFF [OFF]&quot; + &quot;|r&quot;)
    loop
        exitwhen i == classes+2
        call MultiboardSetItemValueBJ( dat.m, 1, i, EquipName[i-1] )
        set i = i + 1
endloop
    call MultiboardDisplay(dat.m,false)
    call UnitAddAbility(u,openabi)
    call UnitAddAbility(u,autoadd)
    call UnitRemoveItemFromSlot(u,5)
    call UnitAddItemToSlotById(u,inventitem,5)
    set dat.invent = UnitItemInSlot(u,5)
    call GroupAddUnit(g,u)
    set DATAS[total] = dat
    set total = total + 1
endfunction

function DestroyInventory takes unit u returns boolean
    local data dat = GetData(u)
    local integer i = 0
    if dat == 0 then
        return false
    endif
    loop
        exitwhen i &gt; total
        if dat == DATAS<i> then
            call MultiboardDisplay(dat.m,false)
            call UnitRemoveAbility(u,openabi)
            call UnitRemoveAbility(u,autoadd)
            call UnitRemoveAbility(u,dropabi)
            call UnitRemoveAbility(u,equipabi)
            call UnitRemoveItemFromSlot(u,5)
            call GroupRemoveUnit(g,u)
            set DATAS<i> = DATAS[total - 1]
            set total = total - 1
            call dat.destroy()
            return true
        endif
        set i = i + 1
    endloop
    return true
endfunction

private function abilities takes nothing returns nothing
    local data dat
    local unit u = GetTriggerUnit()
    local integer i = GetPlayerId(GetOwningPlayer(u))
    local boolean b
    if (GetSpellAbilityId() == openabi) then
        set dat = GetData(u)
        if board<i> != null then
            call MultiboardDisplay(board<i>,false)
            call UnitRemoveAbility(u,dropabi)
            call UnitRemoveAbility(u,equipabi)
            set board<i> = null
            set t<i> = null
        else
            set x<i> = 3
            set y<i> = 2
            call MultiboardDisplay(dat.m,true)
            call MultiboardMinimize(dat.m, false)
            set board<i> = dat.m
            set t<i> = dat.u
            call UnitAddAbility(u,dropabi)
            call UnitAddAbility(u,equipabi)
            call UpdateDescription(i)
        endif
    elseif (GetSpellAbilityId() == dropabi) then
        set dat = GetData(u)
        set b = dat.auto
        set dat.auto = false
        if x<i> == 3 then
            if dat.stack[y<i>]!=0 then
                call SetItemCharges(UnitAddItemById(dat.u, itemm[dat.slot2index[y<i>]]),dat.stack[y<i>])
            else
                call UnitAddItemById(dat.u, itemm[dat.slot2index[y<i>]])
            endif
        else
            call UnitAddItemById(dat.u, itemm[dat.slot2index[y<i>+28]])
        endif
        call dat.RemoveItem(i)
        set dat.auto = b
    elseif (GetSpellAbilityId() == equipabi) then
        set dat = GetData(u)
        if x<i> == 1 then
            call dat.Unequip(i,y<i>)
        else
            call dat.Equip(i)
        endif
    elseif (GetSpellAbilityId() == autoadd) then
        set dat = GetData(u)
        if dat.auto == false then
            set dat.auto = true
            call MultiboardSetItemValueBJ( dat.m, 2, 5, help + &quot;T = AutoPickup ON/OFF [ON]&quot; + &quot;|r&quot;)
        else
            set dat.auto = false
            call MultiboardSetItemValueBJ( dat.m, 2, 5, help + &quot;T = AutoPickup ON/OFF [OFF]&quot; + &quot;|r&quot;)
        endif
    endif
    set u = null
endfunction

private function AddingItemsAndMultiboardStuff takes nothing returns nothing
    local data dat
    local unit u
    local group d =CreateGroup()
    local item ite
    local boolean b
    local integer i = 0
    loop
        exitwhen i &gt; bj_MAX_PLAYER_SLOTS
        if board<i> != null then
        if IsUnitSelected(t<i>,Player(i)) == false then
            set dat = GetData(t<i>)
            call MultiboardDisplay(dat.m,false)
            set board<i> = null
            call UnitRemoveAbility(dat.u,dropabi)
            call UnitRemoveAbility(dat.u,equipabi)
            set t<i> = null
        endif
        if IsMultiboardMinimized(board<i>) and board<i> != null then
            call MultiboardMinimize(board<i>,false)
        endif
        endif
        set i = i + 1
    endloop
    call GroupAddGroup(g,d)
    loop
        set u = FirstOfGroup(d)
        exitwhen u == null
        set ite = UnitItemInSlot(u,5)
        if GetItemTypeId(ite) != inventitem then
            if IsItemRegistered(GetItemTypeId(ite)) then
                set dat = GetData(u)
                if dat.lu == 28 then
                    call UnitRemoveItem(u,ite)
                endif
                call dat.AddItem(ite)
                call RemoveItem(dat.invent)
                call UnitAddItemToSlotById(u,inventitem,5)
                set dat.invent = UnitItemInSlot(u,5)
                if ite != null then
                    call UnitAddItem(u,ite)
                endif
            else
                set dat = GetData(u)
                set b = dat.auto
                set dat.auto = false
                set ite = UnitRemoveItemFromSlot(dat.u,5)
                call RemoveItem(dat.invent)
                call UnitAddItemToSlotById(u,inventitem,5)
                set dat.invent = UnitItemInSlot(u,5)
call UnitAddItem(dat.u,ite)
                set dat.auto = b
            endif
        endif
        call GroupRemoveUnit(d,u)
    endloop
    call DestroyGroup(d)
    set d = null
    set u = null
    set ite = null
endfunction

function UnitHasItemOfId takes unit u, integer itemid returns boolean
     local data dat = GetData(u)
     local integer a = 0
     if dat == 0 then
        return false
     endif
     loop
        exitwhen a == 56
        if itemm[dat.slot2index[a]] == itemid then
            return true
        endif
        set a = a + 1
    endloop
    return false
endfunction

private function GetXOfItemOfId takes unit u, integer itemid returns integer
     local data dat = GetData(u)
     local integer a = 0
     loop
        exitwhen a == 56
        if itemm[dat.slot2index[a]] == itemid then
            if a &gt; 28 then
            return 1
            endif
            return 3
        endif
        set a = a + 1
    endloop
    return 0
endfunction

private function GetYOfItemOfId takes unit u, integer itemid returns integer
     local data dat = GetData(u)
     local integer a = 0
     loop
exitwhen a == 56
        if itemm[dat.slot2index[a]] == itemid then
            if a &gt; 28 then
            return a-28
            endif
            return a
        endif
        set a = a + 1
    endloop
    return 0
endfunction

function DropItemById takes unit fromwhich, integer itemid returns item
    local data dat = GetData(fromwhich)
    local item ite
    local integer i = GetPlayerId(GetOwningPlayer(dat.u))
    local boolean b
    local integer xx = x<i>
    local integer yy = y<i>
    if dat == 0 then
        return null
    endif
    set b = dat.auto
    set dat.auto = false
    set x<i> = GetXOfItemOfId(dat.u,itemid)
    set y<i> = GetYOfItemOfId(dat.u,itemid)
    if x<i> != 0 and y<i> != 0 then
        if x<i> == 3 then
            if dat.stack[y<i>]!=0 then
                set ite = UnitAddItemById(dat.u, itemm[dat.slot2index[y<i>]])
                call SetItemCharges(ite,dat.stack[y<i>])
            else
                set ite = UnitAddItemById(dat.u, itemm[dat.slot2index[y<i>]])
endif
        else
            set ite = UnitAddItemById(dat.u, itemm[dat.slot2index[y<i>+28]])
        endif
        call dat.RemoveItem(i)
    endif
    set dat.auto = b
    set x<i> = xx
    set y<i> = yy
    return ite
endfunction

function RemoveItemById takes unit fromwhich, integer itemid returns nothing
    local data dat = GetData(fromwhich)
    if dat == 0 then
        return
    endif
    call RemoveItem(DropItemById( fromwhich, itemid))
endfunction

private function autopick takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local data dat = GetData(u)
    local item ite = GetManipulatedItem()
        if GetItemTypeId(ite) != inventitem and IsItemRegistered(GetItemTypeId(ite)) then
            call dat.AddItem(ite)
        endif
    set u = null
    set ite = null
endfunction

private function check takes nothing returns boolean
    return GetData(GetTriggerUnit()).auto == true
endfunction

private function LEFTpress takes nothing returns nothing
    local integer i = GetPlayerId(GetTriggerPlayer())
    set x<i> = x<i> - 1
    if x<i> == 0 then
        set x<i> = 3
    elseif x<i> == 2 then
        set x<i> = 1
        if y<i> &gt; classes+1 then
            set y<i> = classes+1
        endif
    endif
    call UpdateDescription(i)
endfunction

private function UPpress takes nothing returns nothing
    local integer i = GetPlayerId(GetTriggerPlayer())
    set y<i> = y<i> - 1
    if y<i> == 1 then
        if x<i> == 3 then
            set y<i> = 28
        else
            set y<i> = classes+1
        endif
    endif
    call UpdateDescription(i)
endfunction

private function DOWNpress takes nothing returns nothing
    local integer i = GetPlayerId(GetTriggerPlayer())
    set y<i> = y<i> + 1
    if x<i> == 3 then
    if y<i> == 29 then
        set y<i> = 2
    endif
    else
    if y<i> == classes+2 then
        set y<i> = 2
    endif
    endif
    call UpdateDescription(i)
endfunction

private function RIGHTpress takes nothing returns nothing
    local integer i = GetPlayerId(GetTriggerPlayer())
    set x<i> = x<i> + 1
    if x<i> == 4 then
        set x<i> = 1
        if y<i> &gt; classes+1 then
            set y<i> = classes+1
        endif
    elseif x<i> == 2 then
        set x<i> = 3
    endif
    call UpdateDescription(i)
endfunction

//! textmacro KEY takes KEY
set ttt = CreateTrigger()
call TriggerRegisterPlayerKeyEventBJ( ttt, Player(i), bj_KEYEVENTTYPE_DEPRESS, bj_KEYEVENTKEY_$KEY$ )
call TriggerAddAction( ttt, function $KEY$press )
//! endtextmacro

private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    local trigger tt = CreateTrigger()
    local trigger ttt = CreateTrigger()
    local integer i = 0

    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddAction(t, function abilities)

    call TriggerRegisterTimerEvent(tt,0.01,true)
    call TriggerAddAction(tt, function AddingItemsAndMultiboardStuff)

    call TriggerRegisterAnyUnitEventBJ( ttt, EVENT_PLAYER_UNIT_PICKUP_ITEM )
    call TriggerAddAction(ttt, function autopick)
    call TriggerAddCondition(ttt, Condition(function check))

    loop
        exitwhen i == 12
        //! runtextmacro KEY(&quot;LEFT&quot;)
        //! runtextmacro KEY(&quot;RIGHT&quot;)
        //! runtextmacro KEY(&quot;UP&quot;)
        //! runtextmacro KEY(&quot;DOWN&quot;)
        set x<i> = 3
        set y<i> = 2
        set i = i + 1
    endloop

    call InitItems()
    call InitEquipment()
endfunction

endlibrary</i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i>



edit (later this day) sad face, nobody wan help m3h :[....maybe someone will tomaroo
 

cleeezzz

The Undead Ranger.
Reaction score
268
imma be honest. ive tried twice and i cant seem to get it =/

it might have to do with those returns inside loops, but im not sure
 

Viikuna

No Marlo no game.
Reaction score
265
Yea, that guy uses loads of returns to abort his fucntions, so it is probably some of those returns inside if/then/else or loops.

So, it is one easy but long and boring job to fix that thingy.
 

D.K.

New Member
Reaction score
11
There are a lot of systems that fail to work and currently there's no updates for most of it =/
 

Sui-cookie

You can change this now in User CP.
Reaction score
49
hmmmmz, so... its possible to fix :confused:

the whicher couldnt do it, and cleeezzz has had problems....it seems like a lost cause :(
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    I ordered like five blocks for 15 dollars. They're just little aluminum blocks with holes drilled into them
  • Varine Varine:
    They are pretty much disposable. I have shitty nozzles though, and I don't think these were designed for how hot I've run them
  • Varine Varine:
    I tried to extract it but the thing is pretty stuck. Idk what else I can use this for
  • Varine Varine:
    I'll throw it into my scrap stuff box, I'm sure can be used for something
  • Varine Varine:
    I have spare parts for like, everything BUT that block lol. Oh well, I'll print this shit next week I guess. Hopefully it fits
  • Varine Varine:
    I see that, despite your insistence to the contrary, we are becoming a recipe website
  • Varine Varine:
    Which is unique I guess.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top