- Joined
- Jul 26, 2008
- Messages
- 1,009
Alright, so I wanted to create a fairly simple multiboard that would display a description (In this case of a skill) to the player.
I realized not all the text would fit neatly on a multiboard if I shoved it all into one row.
So I decided to create a loop that would draw the text onto the row up to a certain point, then save the rest of the text and start a new row.
Simple enough.
Well this is how the Hashtable for the description is initialized:
This is the multiboard initialize:
And this is the code that calls up the multiboard:
Well the two problems currently are these:
The first time I enter a skill name it gives me a blank board, but from there it's fine.
I need a way to create a "linebreak" on a space instead of in the middle of a word.
Bonus points to anyone who can also help me make this multiboard different per player. I assume it's localplayer stuff but I'm not always sure how to play with it properly, and messing it up is disastrous.
I realized not all the text would fit neatly on a multiboard if I shoved it all into one row.
So I decided to create a loop that would draw the text onto the row up to a certain point, then save the rest of the text and start a new row.
Simple enough.
Well this is how the Hashtable for the description is initialized:
JASS:
call SaveStr(AH, 'WhWi', 1, "|cffaca899W|rhirlwind:/ Create a whirling wind that sucks up units that get to close. As you channel the units raise higher and higher, causing more damage on impact with the ground when the whirlwind is released.//|cffffd700Level increases duration of the whirlwind.|r" )
This is the multiboard initialize:
JASS:
set DescrBoard = CreateMultiboard()
call MultiboardSetItemsStyle(DescrBoard, true, false)
call MultiboardSetColumnCount(DescrBoard, 1)
call MultiboardSetItemsWidth(DescrBoard,0.2)
And this is the code that calls up the multiboard:
JASS:
//(Note that skillhash[text] returns a rawcode based on the text entered.)
call MultiboardSetTitleText(DescrBoard, GetObjectName(skillhash[text])+" Description")
set text = LoadStr(AH, skillhash[text], 1)
set num = 1
loop
exitwhen StringLength(text) < 2
set i2 = 1
loop
exitwhen i2 > StringLength(text) or SubString(text, i2-1, i2) == "/" or i2 > 46
set i2 = i2 + 1
endloop
if SubString(text, i2-1, i2) == "/" then
call MultiboardSetItemValueBJ(DescrBoard, 1, num, SubString(text, 0, i2-1))
set text = SubString(text, i2, StringLength(text))
else
call MultiboardSetItemValueBJ(DescrBoard, 1, num, SubString(text, 0, i2))
set text = SubString(text, i2, StringLength(text))
endif
set num = num + 1
endloop
call MultiboardSetRowCount(DescrBoard, num)
call MultiboardDisplay(DescrBoard, true)
Well the two problems currently are these:
The first time I enter a skill name it gives me a blank board, but from there it's fine.
I need a way to create a "linebreak" on a space instead of in the middle of a word.
Bonus points to anyone who can also help me make this multiboard different per player. I assume it's localplayer stuff but I'm not always sure how to play with it properly, and messing it up is disastrous.