scripting:samples:functionbuilding
This is an old revision of the document!
[code]$kConstructionStructSize = 6 Function ConstructionListOSD( $aConstructionList, $selectFunc ) {
$index = 1 $lineY = 40 $imageX = 100 $textX = 200 $subtextWidth = 300 $index = 1 $count = 0
while( $aConstructionList[$index+1] >= 0 )
{
$buildingName = $aConstructionList[$index]
$buildingType = $aConstructionList[$index+1]
$price = $aConstructionList[$index+2]
$imageName = $aConstructionList[$index+4]
$desc = $aConstructionList[$index+5]
$buildTechLevel = sysGetBuildingTypeTechLevel( $buildingType ) $matReqd = sysGetConstructionMaterialsAmount( $buildingType ) $price = sysGetSecondaryConstructionPrice( $buildingType ) osdaddat(IMAGE, $imageX, $lineY, 90, 90, "$selectFunc|$buildingType|$price", "$imageName") $textY = $lineY osdaddat(BIGTEXT, $textX, $textY, 0, 0, "", "$buildingName" ) $textY += 20 $priceText = sysGetPriceText( $price ) osdaddat(SMALLTEXT, $textX, $textY, 0, 0, "", "Cost: $priceText ( + town tax )" ) $textY += 15
if ( $buildTechLevel == 0 )
{
osdaddat(SMALLTEXT, $textX, $textY, 0, 0, "", "Req: $matReqd Wood" )
}
else if ( $buildTechLevel == 1)
{
osdaddat(SMALLTEXT, $textX, $textY, 0, 0, "", "Req: $matReqd Wood & Stone Blocks" )
}
$subtextY = $textY + 20
osdaddat(FADEDSMALLTEXT, $textX, $subtextY, $subtextWidth, 0, "", "$desc" )
$lineY += 100 $index += $kConstructionStructSize $count += 1 }
} [/code]
scripting/samples/functionbuilding.1581546205.txt.gz · Last modified: (external edit)
