Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // execute_file("testing_step.scr");
- if (canUseMenu == 1) {
- // control item selector
- if mode == "selectMode" {
- if keyboard_check_pressed(vk_right) {
- modeSelected += 1
- if modeSelected > maxNumModes {
- modeSelected = 1;
- }
- }
- if keyboard_check_pressed(vk_left) {
- modeSelected -= 1
- if modeSelected < 1 {
- modeSelected = maxNumModes;
- }
- }
- if keyboard_check_pressed(global.control_button1) {
- keyboard_clear(global.control_button1);
- switch (modeSelected) {
- case 1: {
- mode = "selectItem"
- break;
- }
- }
- }
- if keyboard_check_pressed(global.control_button2) { // back
- fade_mode = 10;
- }
- }
- if mode == "selectItem" {
- if mode == "selectItem" {
- if keyboard_check_pressed(global.control_button1) {
- mode = "selectActor"
- maxQuantity = global.itemsInBag[itemIndex+pivot,1]
- keyboard_clear(global.control_button1);
- }
- }
- if keyboard_check_pressed(global.control_button2) { // back
- mode = "selectMode";
- }
- if keyboard_check_pressed(vk_down) {
- if (itemIndex mod 2 == 0) { // right column
- if itemIndex+pivot+1 < global.itemsInBag[0,0] {
- // game_restart()
- if itemIndex +1 <= maxItemsToShow-1 { // if passed the limit to show
- itemIndex += 2
- } else { // augment pivot
- pivot +=2;
- }
- } else {
- if global.itemsInBag[0,0] - itemIndex-pivot > 0 {
- if itemIndex = maxItemsToShow {
- itemIndex -=1;
- pivot +=2;
- } else {
- itemIndex +=1;
- }
- }
- }
- } else {
- if itemIndex+pivot+1 < global.itemsInBag[0,0] {
- if itemIndex +1 <= maxItemsToShow-1 {
- itemIndex += 2
- } else {
- pivot +=2
- }
- }
- }
- }
- if keyboard_check_pressed(vk_up) {
- if (itemIndex mod 2 == 0) {
- if itemIndex+pivot > 0+2 {
- if itemIndex -1 >= 0+2 { // if passed the limit to show
- itemIndex -= 2
- } else { // augment pivot
- pivot -=2;
- }
- }
- } else {
- if itemIndex+pivot > 0+1 {
- if itemIndex -1 >= 0+1 {
- itemIndex -= 2
- } else {
- pivot -=2
- }
- }
- }
- }
- if keyboard_check_pressed(vk_right) {
- if itemIndex+pivot < global.itemsInBag[0,0] {
- // show_message("durrrr");
- if (itemIndex mod 2 == 0) {
- if itemIndex - 1 <= global.itemsInBag[0,0] {
- itemIndex -= 1
- }
- } else {
- if itemIndex + 1 <= global.itemsInBag[0,0] {
- itemIndex += 1
- }
- }
- } else {
- itemIndex -= 1
- }
- }
- if keyboard_check_pressed(vk_left) {
- if itemIndex+pivot < global.itemsInBag[0,0] {
- if (itemIndex mod 2 == 0) {
- if itemIndex - 1 <= global.itemsInBag[0,0] {
- itemIndex -= 1
- }
- } else {
- if itemIndex + 1 <= global.itemsInBag[0,0] {
- itemIndex += 1
- }
- }
- } else {
- itemIndex -= 1
- }
- }
- }
- if mode == "selectActor" {
- if keyboard_check_pressed(vk_up) {
- selectActor += 1
- if selectActor > partySize {
- selectActor = 1;
- }
- }
- if keyboard_check_pressed(vk_down) {
- selectActor -= 1
- if selectActor < 1 {
- selectActor = partySize;
- }
- }
- if keyboard_check_pressed(global.control_button1) { // accept
- mode = "assignItem";
- keyboard_clear(global.control_button1);
- }
- if keyboard_check_pressed(global.control_button2) { // back
- mode = "selectItem";
- }
- }
- if mode == "selectPocketSlot" {
- if keyboard_check_pressed(vk_down) {
- pocketSlotSelected += 1
- if pocketSlotSelected > 4 {
- pocketSlotSelected = 1;
- }
- }
- if keyboard_check_pressed(vk_up) {
- pocketSlotSelected -= 1
- if pocketSlotSelected < 1 {
- pocketSlotSelected = 4;
- }
- }
- if keyboard_check_pressed(global.control_button2) { // back
- mode = "selectItem";
- }
- }
- if mode == "assignItem" { //assign items to heroes
- if selectQuantity > 0 {
- selectQuantity = maxQuantity
- if keyboard_check_pressed(vk_left) {
- if selectQuantity > 1 {
- selectQuantity -= 1;
- }
- }
- if keyboard_check_pressed(vk_right) {
- if maxQuantity > global.itemsInBag[itemIndex+pivot,1] {
- maxQuantity = global.itemsInBag[itemIndex+pivot,1]
- }
- if selectQuantity < maxQuantity {
- selectQuantity += 1;
- }
- }
- if keyboard_check_pressed(global.control_button1) {
- switch (selectActor) {
- case 1: {
- if global.actor1Items[0,0] == global.itemsInDB[global.itemsInBag[itemIndex+pivot,0],0] {
- totalQuantities = global.actor1Items[0,1] + selectQuantity
- if totalQuantities > 4 {
- selectQuantity = 4 - global.actor1Items[0,1];
- }
- }
- // do the dip
- scr_assignItemToActor("actor1",0,global.itemsInDB[global.itemsInBag[itemIndex+pivot,0],0],selectQuantity);
- break;
- }
- case 2: {
- if global.actor2Items[0,0] == global.itemsInDB[global.itemsInBag[itemIndex+pivot,0],0] {
- totalQuantities = global.actor2Items[0,1] + selectQuantity
- if totalQuantities > 4 {
- selectQuantity = 4 - global.actor2Items[0,1];
- }
- }
- // do the dip
- scr_assignItemToActor("actor2",0,global.itemsInDB[global.itemsInBag[itemIndex+pivot,0],0],selectQuantity);
- break;
- }
- case 3: {
- if global.actor3Items[0,0] == global.itemsInDB[global.itemsInBag[itemIndex+pivot,0],0] {
- totalQuantities = global.actor3Items[0,1] + selectQuantity
- if totalQuantities > 4 {
- selectQuantity = 4 - global.actor3Items[0,1];
- }
- }
- // do the dip
- scr_assignItemToActor("actor3",0,global.itemsInDB[global.itemsInBag[itemIndex+pivot,0],0],selectQuantity);
- break;
- }
- case 4: {
- if global.actor4Items[0,0] == global.itemsInDB[global.itemsInBag[itemIndex+pivot,0],0] {
- totalQuantities = global.actor4Items[0,1] + selectQuantity
- if totalQuantities > 4 {
- selectQuantity = 4 - global.actor4Items[0,1];
- }
- }
- // do the dip
- scr_assignItemToActor("actor4",0,global.itemsInDB[global.itemsInBag[itemIndex+pivot,0],0],selectQuantity);
- break;
- }
- }
- if !(global.itemsInBag[0,0] mod 2 == 0){
- if maxQuantity = selectQuantity {
- if pivot >= 2 {
- pivot -= 2;
- } else {
- if itemIndex > 1 {
- itemIndex -= 1
- }
- }
- }
- }
- // reset some variables
- selectQuantity = 1;
- mode = "selectItem"
- // reset all the item data
- global.itemsInBag[0,0] = 0; // quantity, use a for
- global.itemsInBag[0,1] = 0; // columns args
- counter = 1;
- // put items in bag
- for (i=1;i<=global.itemsInDB[0,0];i+=1) {
- if global.itemsInDB[i,1] > 0 {
- global.itemsInBag[counter,0] = global.itemsInDB[i,0]; // id
- global.itemsInBag[counter,1] = global.itemsInDB[i,1]; // quantity
- global.itemsInBag[counter,2] = global.itemsInDB[i,2]; // name
- counter += 1;
- }
- global.itemsInBag[0,0] = counter-1;
- }
- // reduce items to show if you don't have those item quantity
- if maxItemsToShow > global.itemsInBag[0,0] {
- maxItemsToShow = global.itemsInBag[0,0]
- }
- }
- }
- }
- }
- // FADE ANIM BLOCK
- if fade_mode > 0 { // to black
- gralAlpha = 0;
- fade_timer = fade_mode;
- fade_mode = -1;
- }
- if fade_mode = -1 {
- if (gralAlpha < 1) {gralAlpha += 0.1;} else {
- if fade_switch == 1 {
- fade_switch = 0;
- o_player.canMove = 1;
- } else {
- fade_switch = 1;
- }
- fade_mode = -2;
- }
- }
- if fade_mode = -2 {
- if (fade_timer > 0) {
- fade_timer -= 1;
- } else {
- if canUseMenu == 1 {
- canUseMenu = 0;
- } else {
- canUseMenu = 1;
- }
- fade_mode = -3;
- }
- }
- if fade_mode = -3 { // to white
- if (gralAlpha > 0) {gralAlpha -= 0.1;} else {
- fade_mode = 0;
- if canUseMenu == 0 {
- instance_destroy();
- }
- }
- }
- // ///////////////////
- // if fade_switch == 1 {
- // o_player.canMove = 1;
- //
- // }
Add Comment
Please, Sign In to add comment