scripting:samples:genericschool
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| scripting:samples:genericschool [2023/07/04 08:25] – mit | scripting:samples:genericschool [2025/05/28 18:58] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ===== Generic School Script ===== | ===== Generic School Script ===== | ||
| - | + | {{http:// | |
| - | Standard school script used on lovelace (etc). | + | \\ |
| + | Standard school script used on lovelace (etc). | ||
| + | (Alternatively, | ||
| < | < | ||
| + | #include " | ||
| $kSchoolStructSize = 7 | $kSchoolStructSize = 7 | ||
| - | $kUniversityBuildingNum = 40 | ||
| + | $kExampleSchoolBuildingNum = 2 | ||
| + | $kUniversityBuildingNum = 40 | ||
| - | $maUniversityList[] = | + | $maLessonsList[] = |
| - | {// cat. skill name price learn time graphic desc | + | {// cat. |
| - | 0, | + | 0, |
| - | 0, | + | 0, |
| - | 0, | + | 0, |
| - | 0, | + | 0, |
| + | |||
| + | 1, | ||
| + | 1, | ||
| + | 1, | ||
| + | 1, | ||
| -1, | -1, | ||
| } | } | ||
| + | // | ||
| + | // Building Access functions.. add these for each school type | ||
| + | |||
| + | Event( " | ||
| + | { | ||
| + | // Parameter is the skills category to show | ||
| + | SchoolShowMainOSD( 0 ) | ||
| + | } | ||
| Event( " | Event( " | ||
| { | { | ||
| - | SchoolShowMainOSD( | + | |
| + | | ||
| } | } | ||
| - | Function SchoolShowMainOSD( $aLessonsList | + | // |
| + | |||
| + | Function SchoolShowMainOSD( $category | ||
| { | { | ||
| if ( $gPlayerNumSkills >= $kMaxNumSkills ) | if ( $gPlayerNumSkills >= $kMaxNumSkills ) | ||
| { | { | ||
| osdcreate(OSDBUILDING," | osdcreate(OSDBUILDING," | ||
| - | osdaddat(FADEDTEXT, 50, 5, 500, 25, "", | + | osdadd(FADEDTEXT, 50, 5, 500, 25, "", |
| - | osdaddat(FADEDBUTTON, | + | osdadd(FADEDBUTTON, |
| - | osdaddat(SMALLFADEDTEXT, | + | osdadd(SMALLFADEDTEXT, |
| osdactivate() | osdactivate() | ||
| } | } | ||
| else | else | ||
| { | { | ||
| - | | + | |
| } | } | ||
| } | } | ||
| Line 42: | Line 62: | ||
| Event( " | Event( " | ||
| { | { | ||
| - | $skillNum = $gParam[1] | + | |
| - | $price = $gParam[2] | + | $price = $gParam[2] |
| - | // Unpleasant hack to get the lessons list for a building in later events.. Scripting language should really provide a better way to handle this.. | + | SchoolShowBuySkillConfirm( $maLessonsList, $skillNum ) |
| - | if ( $gBuildingCode == $kUniversityBuildingNum ) | + | |
| - | { | + | |
| - | $aLessonsList = $maUniversityList | + | |
| - | } | + | |
| - | // (** If you want to have multiple school types, you will need to additional else if statements here) | + | |
| - | SchoolShowBuySkillConfirm( $aLessonsList, $skillNum ) | + | |
| } | } | ||
| + | </ | ||
| + | **BaseSchool.mit** : | ||
| + | < | ||
| // | // | ||
| Function SchoolGetModifiedLearnTime( $baseDays ) | Function SchoolGetModifiedLearnTime( $baseDays ) | ||
| Line 114: | Line 131: | ||
| $skillPrice = SchoolGetModifiedPrice( $skillPrice ) | $skillPrice = SchoolGetModifiedPrice( $skillPrice ) | ||
| - | osdaddat(BIGTEXT, 0, 0, 600, 0, "", | + | osdadd(BIGTEXT, 0, 0, 600, 0, "", |
| - | osdaddat(IMAGE, 50, 60, 200, 200, "", | + | osdadd(IMAGE, 50, 60, 200, 200, "", |
| $textX = 300 | $textX = 300 | ||
| Line 123: | Line 140: | ||
| $subText = " | $subText = " | ||
| - | osdaddat(FADEDTEXT, $textX, $subtextY, $subtextWidth, | + | osdadd(FADEDTEXT, $textX, $subtextY, $subtextWidth, |
| $subtextY += 40 | $subtextY += 40 | ||
| $learnTimeText = sysGetRealTimeTextForDays( $learnTimeDays ); | $learnTimeText = sysGetRealTimeTextForDays( $learnTimeDays ); | ||
| - | osdaddat(BIGTEXT, $textX, $subtextY, 0, 0, "", | + | osdadd(BIGTEXT, $textX, $subtextY, 0, 0, "", |
| $subtextY += 26 | $subtextY += 26 | ||
| - | osdaddat(FADEDTEXT, $textX + 40, $subtextY, 0, 0, "", | + | osdadd(FADEDTEXT, $textX + 40, $subtextY, 0, 0, "", |
| $subtextY += 25 | $subtextY += 25 | ||
| - | osdaddat(BIGTEXT, $textX, $subtextY, 0, 0, "", | + | osdadd(BIGTEXT, $textX, $subtextY, 0, 0, "", |
| $subtextY += 30 | $subtextY += 30 | ||
| Line 139: | Line 156: | ||
| if ( $hasSkill > 0 ) | if ( $hasSkill > 0 ) | ||
| { | { | ||
| - | osdaddat(FADEDBUTTON, | + | osdadd(FADEDBUTTON, |
| } | } | ||
| else if ( $isLearning == 1 ) | else if ( $isLearning == 1 ) | ||
| { | { | ||
| - | osdaddat(FADEDBUTTON, | + | osdadd(FADEDBUTTON, |
| } | } | ||
| else if ( $gPlayerCash < $skillPrice ) | else if ( $gPlayerCash < $skillPrice ) | ||
| { | { | ||
| - | osdaddat(FADEDBUTTON, | + | osdadd(FADEDBUTTON, |
| } | } | ||
| else | else | ||
| { | { | ||
| - | osdaddat(EXITBUTTON, | + | osdadd(EXITBUTTON, |
| } | } | ||
| - | osdaddat(BUTTON, 200, 330, 200, 30, " | + | osdadd(BUTTON, 200, 330, 200, 30, " |
| osdactivate() | osdactivate() | ||
| } | } | ||
| Line 201: | Line 218: | ||
| $skillPrice = SchoolGetModifiedPrice( $skillPrice ) | $skillPrice = SchoolGetModifiedPrice( $skillPrice ) | ||
| - | osdaddat(IMAGE, $imageX, $lineY, 90, 90, " | + | osdadd(IMAGE, $imageX, $lineY, 90, 90, " |
| $textY = $lineY + 5 | $textY = $lineY + 5 | ||
| $priceText = sysGetPriceText( $skillPrice ) | $priceText = sysGetPriceText( $skillPrice ) | ||
| - | osdaddat(BIGTEXT, $textX, $textY, 0, 0, "", | + | osdadd(BIGTEXT, $textX, $textY, 0, 0, "", |
| $subtextY = $textY + 21 | $subtextY = $textY + 21 | ||
| - | osdaddat(TEXT, $textX, $subtextY, 0, 0, "", | + | osdadd(TEXT, $textX, $subtextY, 0, 0, "", |
| $subtextY = $textY + 40 | $subtextY = $textY + 40 | ||
| $subText = " | $subText = " | ||
| - | osdaddat(FADEDSMALLTEXT, | + | osdadd(FADEDSMALLTEXT, |
| if ( $numLessons <= 3 ) | if ( $numLessons <= 3 ) | ||
| Line 240: | Line 257: | ||
| } | } | ||
| - | osdaddat(BUTTON, 200, 330, 200, 30, " | + | osdadd(BUTTON, 200, 330, 200, 30, " |
| osdactivate() | osdactivate() | ||
| } | } | ||
scripting/samples/genericschool.1688459120.txt.gz · Last modified: (external edit)
