Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RESULT_NEXT_PAGE equ 100
- RESULT_PREVIOUS_PAGE equ 101
- RESULT_CANCEL equ 102
- VAR_BERRY_ID equ VAR_SPECIAL_x8001
- VAR_ENTRIES equ VAR_SPECIAL_x8002
- VAR_PAGE equ VAR_SPECIAL_x8003
- VAR_UPPER_LIMIT_PG0 equ VAR_SPECIAL_x8007
- VAR_UPPER_LIMIT_PG1 equ VAR_SPECIAL_x8008
- // script for the berry trees
- scr_seq_0003_072_BerryTree:
- // ... _plantberryinit starts the menu
- _plantberryinit:
- setvar VAR_PAGE, 0 // initial page
- _plantberry:
- swap_out_list_std // custom script command to swap the text bank that the list pulls from
- // create berry menu, store result in VAR_SPECIAL_x8004
- prepare_list_std_text 1, 1, 0, 1, VAR_SPECIAL_x8004
- compare VAR_PAGE, 1
- goto_if_eq _page1
- compare VAR_PAGE, 2
- goto_if_eq _page2
- _page0:
- setvar VAR_BERRY_ID, 0
- goto _afterPages
- _page1:
- copyvar VAR_BERRY_ID, VAR_UPPER_LIMIT_PG0
- goto _afterPages
- _page2:
- copyvar VAR_BERRY_ID, VAR_UPPER_LIMIT_PG1
- //goto _afterPages
- _afterPages:
- setvar VAR_ENTRIES, 0 // actual entries printed on the page
- _loopMenuIncrement:
- convert_var_between_berry_ids VAR_BERRY_ID // convert to berry item, custom script command
- hasitem VAR_BERRY_ID, 1, VAR_SPECIAL_RESULT
- convert_var_between_berry_ids VAR_BERRY_ID // convert back to berryid, custom script command
- compare VAR_SPECIAL_RESULT, 0
- goto_if_eq _skipAdd
- add_list_option VAR_BERRY_ID, 64, VAR_BERRY_ID // berry id corresponds with text entry in the new text bank. all have a blurb that is entry 64
- addvar VAR_ENTRIES, 1 // increment amount of entries shown
- _skipAdd:
- addvar VAR_BERRY_ID, 1
- compare VAR_PAGE, 0
- goto_if_ne _skipIncPg0Up
- copyvar VAR_UPPER_LIMIT_PG0, VAR_BERRY_ID
- _skipIncPg0Up:
- compare VAR_PAGE, 1
- goto_if_ne _skipIncPg1Up
- copyvar VAR_UPPER_LIMIT_PG1, VAR_BERRY_ID
- _skipIncPg1Up:
- compare VAR_BERRY_ID, NUM_OF_BERRIES
- goto_if_eq _skipNext // if the last possible berry is encountered, skip the rest of the menu creation and printing next to just print previous if possible
- compare VAR_ENTRIES, 25 // entries per page
- goto_if_ne _loopMenuIncrement
- _printLastOptions:
- compare VAR_PAGE, 2
- goto_if_eq _skipNext
- add_list_option 66, 68, RESULT_NEXT_PAGE // add next
- _skipNext:
- compare VAR_PAGE, 0
- goto_if_eq _skipPrevious
- add_list_option 65, 69, RESULT_PREVIOUS_PAGE // add previous if required
- _skipPrevious:
- add_list_option 67, 70, RESULT_CANCEL // add cancel after the above
- _showlist:
- show_prepared_list
- swap_out_list_std // revert the above swap
- // handle page inputs
- compare VAR_SPECIAL_x8004, RESULT_NEXT_PAGE
- goto_if_eq _incrementPage
- compare VAR_SPECIAL_x8004, RESULT_PREVIOUS_PAGE
- goto_if_eq _decrementPage
- compare VAR_SPECIAL_x8004, RESULT_CANCEL
- goto_if_eq _endPlant
- compare VAR_SPECIAL_x8004, 0xFFFE // the "final slot"
- goto_if_eq _endPlant
- closemsg
- // ... update berry when planted
- _endPlant:
- closemsg
- endstd
- end
- _incrementPage:
- addvar VAR_PAGE, 1
- goto _plantberry
- _decrementPage:
- subvar VAR_PAGE, 1
- goto _plantberry
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement