HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Function Help - No Syntax Error?

02-25-2004, 07:02 PM#1
MysticGeneral
Everytime I put this into my map and save it -- THe WE crashes? Do you see anything wrong with it? :x

Code:
function CreateTheMultiboard takes nothing returns nothing
local integer x = 0
local integer y = 0
local integer a = 0
loop
    exitwhen x > udg_PlayersAmount
    call CreateMultiboardBJ( 13, 8, "Player Chat History" )
    set udg_ChatMultiboard[x] = ( GetLastCreatedMultiboard() )
       loop
          exitwhen y > udg_RowAmount[x]
             loop
             exitwhen a > 40
                if udg_ChatString[a] == "" then
                call MultiboardSetItemValue ( 2, a, udg_ChatString[a] )
                set a = a + 1
             endloop
          set y = y + 1
       endloop
set x = x + 1
endloop
endfunction
02-25-2004, 08:01 PM#2
weaaddar
you forget an endif.
Code:
if udg_ChatString[a] == "" then
      call MultiboardSetItemValue ( 2, a, udg_ChatString[a] )
[b]endif[/b]
However thats not your main concern, thats what cuased WE to crash. I'm really wondering what caused Pjass to crash. As this is definetly the first function I've ever seen to do that.
02-25-2004, 08:01 PM#3
Vidstige
Code:
if udg_ChatString[a] == "" then
requires an
Code:
endif
and the call to
Code:
native MultiboardSetItemValue           takes multiboarditem mbi, string val returns nothing
contains an error.

If you rewrite it as
Code:
function CreateTheMultiboard takes nothing returns nothing
    local integer x = 0
    local integer y = 0
    local integer a = 0
    loop
        exitwhen x > udg_PlayersAmount
        call CreateMultiboardBJ( 13, 8, "Player Chat History" )
        set udg_ChatMultiboard[x] = ( GetLastCreatedMultiboard() )
        loop
            exitwhen y > udg_RowAmount[x]
            loop
                exitwhen a > 40
                if udg_ChatString[a] == "" then
                    call MultiboardSetItemValue (udg_ChatMultiboard[x], udg_ChatString[a] )
                endif
                set a = a + 1
            endloop
            set y = y + 1
        endloop
        set x = x + 1
    endloop
endfunction
it might work. I haven't checked the logic though...

I have seen Pjass crash on similar occasions. It seems that if one forget ssomething fundamentally that Pjass expect, it crashes.
02-25-2004, 08:09 PM#4
weaaddar
That code you posted is also wrong!
call MultiboardSetItemValue (udg_ChatMultiboard[x], udg_ChatString[a] )
It expects an Item not a multiboard itself.
02-25-2004, 08:13 PM#5
MysticGeneral
Ahhh, thx guys. I'm new to JASS >;{ Was told by many JASS is faster and does a lot more things than people say it does.

I also noticed that I forgot "BJ" at MultiboardSetItemValue

It seems to still crash - and the syntax checker still returns me no syntax error. Gah... New code is...

Code:
function CreateTheMultiboard takes nothing returns nothing
local integer x = 0
local integer y = 0
local integer a = 0
loop
    exitwhen x > udg_PlayersAmount
    call CreateMultiboardBJ( 13, 8, "Player Chat History" )
    set udg_ChatMultiboard[x] = ( GetLastCreatedMultiboard() )
       loop
          exitwhen y > udg_RowAmount[x]
             loop
             exitwhen a > 40
                if udg_ChatString[a] == "" then
                   call MultiboardSetItemValueBJ ( 2, a, udg_ChatString[a] )
                endif
                set a = a + 1
             endloop
          set y = y + 1
       endloop
set x = x + 1
endloop
endfunction

And I don't get that part where you guys told me about call MultiboardSetItemValueBJ -- so confused
02-25-2004, 08:37 PM#6
weaaddar
You need to be sending MultiboardSetItemBJ a multiboard item this code should work:
Code:
function CreateTheMultiboard takes nothing returns nothing
    local integer x = 0
    local integer y = 0
    local integer a = 0
    loop
        exitwhen x > udg_PlayersAmount
        call CreateMultiboardBJ( 13, 8, "Player Chat History" )
        set udg_ChatMultiboard[x] = ( GetLastCreatedMultiboard() )
        loop
            exitwhen y > udg_RowAmount[x]
            loop
                exitwhen a > 40
                if udg_ChatString[a] == "" then
                    call MultiboardSetItemValueBJ (udg_ChatMultiboard[x], 2, a ,udg_ChatString[a] )
                endif
                set a = a + 1
            endloop
            set y = y + 1
        endloop
        set x = x + 1
    endloop
endfunction
02-25-2004, 08:39 PM#7
MysticGeneral
Oh, coudl've sworn I did that?! But thanks Weaaddar.
02-26-2004, 05:25 PM#8
MysticGeneral
I just put that code up in my map -- When I call the multiboard to display, it's just this little box with no title and has no rows. Well it has 1 row, but the bottom of it is broken.
02-26-2004, 06:58 PM#9
weaaddar
well syntatically its correct. As far as other stuff I've never liked using mutliboards and I tend to avoid them because they are unituitive.
02-26-2004, 07:07 PM#10
MysticGeneral
-- I replicated the exact thing in GUI, and still does the same thing, odd... I don't... understand? Do I have to set the item text of every column/row in order for it to display?

BTW: Sorry for that douple post up there.