Guest User

Untitled

a guest
Jan 21st, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.24 KB | None | 0 0
  1. // execute_file("testing_step.scr");
  2.  
  3. if (canUseMenu == 1) {
  4. // control item selector
  5.  
  6. if mode == "selectMode" {
  7. if keyboard_check_pressed(vk_right) {
  8. modeSelected += 1
  9. if modeSelected > maxNumModes {
  10. modeSelected = 1;
  11. }
  12. }
  13.  
  14. if keyboard_check_pressed(vk_left) {
  15. modeSelected -= 1
  16. if modeSelected < 1 {
  17. modeSelected = maxNumModes;
  18. }
  19. }
  20.  
  21. if keyboard_check_pressed(global.control_button1) {
  22. keyboard_clear(global.control_button1);
  23. switch (modeSelected) {
  24. case 1: {
  25. mode = "selectItem"
  26. break;
  27. }
  28.  
  29.  
  30. }
  31. }
  32.  
  33. if keyboard_check_pressed(global.control_button2) { // back
  34.  
  35. fade_mode = 10;
  36.  
  37. }
  38.  
  39.  
  40.  
  41.  
  42.  
  43. }
  44.  
  45.  
  46. if mode == "selectItem" {
  47. if mode == "selectItem" {
  48. if keyboard_check_pressed(global.control_button1) {
  49. mode = "selectActor"
  50.  
  51. maxQuantity = global.itemsInBag[itemIndex+pivot,1]
  52.  
  53. keyboard_clear(global.control_button1);
  54. }
  55. }
  56.  
  57. if keyboard_check_pressed(global.control_button2) { // back
  58. mode = "selectMode";
  59.  
  60. }
  61.  
  62.  
  63. if keyboard_check_pressed(vk_down) {
  64. if (itemIndex mod 2 == 0) { // right column
  65.  
  66. if itemIndex+pivot+1 < global.itemsInBag[0,0] {
  67.  
  68. // game_restart()
  69. if itemIndex +1 <= maxItemsToShow-1 { // if passed the limit to show
  70. itemIndex += 2
  71. } else { // augment pivot
  72.  
  73. pivot +=2;
  74.  
  75. }
  76. } else {
  77. if global.itemsInBag[0,0] - itemIndex-pivot > 0 {
  78. if itemIndex = maxItemsToShow {
  79. itemIndex -=1;
  80. pivot +=2;
  81. } else {
  82. itemIndex +=1;
  83. }
  84.  
  85. }
  86.  
  87.  
  88. }
  89.  
  90.  
  91.  
  92.  
  93.  
  94. } else {
  95.  
  96. if itemIndex+pivot+1 < global.itemsInBag[0,0] {
  97.  
  98. if itemIndex +1 <= maxItemsToShow-1 {
  99. itemIndex += 2
  100. } else {
  101. pivot +=2
  102. }
  103.  
  104. }
  105. }
  106. }
  107.  
  108. if keyboard_check_pressed(vk_up) {
  109. if (itemIndex mod 2 == 0) {
  110. if itemIndex+pivot > 0+2 {
  111. if itemIndex -1 >= 0+2 { // if passed the limit to show
  112. itemIndex -= 2
  113. } else { // augment pivot
  114. pivot -=2;
  115. }
  116. }
  117.  
  118. } else {
  119. if itemIndex+pivot > 0+1 {
  120. if itemIndex -1 >= 0+1 {
  121. itemIndex -= 2
  122. } else {
  123.  
  124. pivot -=2
  125. }
  126.  
  127. }
  128. }
  129. }
  130.  
  131.  
  132. if keyboard_check_pressed(vk_right) {
  133. if itemIndex+pivot < global.itemsInBag[0,0] {
  134. // show_message("durrrr");
  135. if (itemIndex mod 2 == 0) {
  136. if itemIndex - 1 <= global.itemsInBag[0,0] {
  137. itemIndex -= 1
  138. }
  139.  
  140. } else {
  141. if itemIndex + 1 <= global.itemsInBag[0,0] {
  142. itemIndex += 1
  143. }
  144. }
  145. } else {
  146. itemIndex -= 1
  147.  
  148. }
  149. }
  150.  
  151. if keyboard_check_pressed(vk_left) {
  152. if itemIndex+pivot < global.itemsInBag[0,0] {
  153.  
  154. if (itemIndex mod 2 == 0) {
  155. if itemIndex - 1 <= global.itemsInBag[0,0] {
  156. itemIndex -= 1
  157. }
  158.  
  159. } else {
  160. if itemIndex + 1 <= global.itemsInBag[0,0] {
  161. itemIndex += 1
  162. }
  163. }
  164. } else {
  165. itemIndex -= 1
  166.  
  167. }
  168. }
  169.  
  170.  
  171. }
  172.  
  173.  
  174. if mode == "selectActor" {
  175. if keyboard_check_pressed(vk_up) {
  176. selectActor += 1
  177. if selectActor > partySize {
  178. selectActor = 1;
  179. }
  180. }
  181.  
  182. if keyboard_check_pressed(vk_down) {
  183. selectActor -= 1
  184. if selectActor < 1 {
  185. selectActor = partySize;
  186. }
  187. }
  188.  
  189. if keyboard_check_pressed(global.control_button1) { // accept
  190. mode = "assignItem";
  191. keyboard_clear(global.control_button1);
  192.  
  193. }
  194.  
  195. if keyboard_check_pressed(global.control_button2) { // back
  196. mode = "selectItem";
  197.  
  198. }
  199.  
  200.  
  201.  
  202.  
  203. }
  204.  
  205.  
  206. if mode == "selectPocketSlot" {
  207. if keyboard_check_pressed(vk_down) {
  208. pocketSlotSelected += 1
  209. if pocketSlotSelected > 4 {
  210. pocketSlotSelected = 1;
  211. }
  212. }
  213.  
  214. if keyboard_check_pressed(vk_up) {
  215. pocketSlotSelected -= 1
  216. if pocketSlotSelected < 1 {
  217. pocketSlotSelected = 4;
  218. }
  219. }
  220.  
  221.  
  222.  
  223.  
  224. if keyboard_check_pressed(global.control_button2) { // back
  225. mode = "selectItem";
  226.  
  227. }
  228.  
  229.  
  230.  
  231. }
  232.  
  233.  
  234. if mode == "assignItem" { //assign items to heroes
  235. if selectQuantity > 0 {
  236.  
  237. selectQuantity = maxQuantity
  238. if keyboard_check_pressed(vk_left) {
  239. if selectQuantity > 1 {
  240. selectQuantity -= 1;
  241. }
  242. }
  243. if keyboard_check_pressed(vk_right) {
  244. if maxQuantity > global.itemsInBag[itemIndex+pivot,1] {
  245. maxQuantity = global.itemsInBag[itemIndex+pivot,1]
  246. }
  247. if selectQuantity < maxQuantity {
  248. selectQuantity += 1;
  249. }
  250. }
  251.  
  252. if keyboard_check_pressed(global.control_button1) {
  253. switch (selectActor) {
  254. case 1: {
  255. if global.actor1Items[0,0] == global.itemsInDB[global.itemsInBag[itemIndex+pivot,0],0] {
  256. totalQuantities = global.actor1Items[0,1] + selectQuantity
  257. if totalQuantities > 4 {
  258. selectQuantity = 4 - global.actor1Items[0,1];
  259. }
  260. }
  261.  
  262. // do the dip
  263. scr_assignItemToActor("actor1",0,global.itemsInDB[global.itemsInBag[itemIndex+pivot,0],0],selectQuantity);
  264.  
  265.  
  266.  
  267. break;
  268. }
  269.  
  270. case 2: {
  271. if global.actor2Items[0,0] == global.itemsInDB[global.itemsInBag[itemIndex+pivot,0],0] {
  272. totalQuantities = global.actor2Items[0,1] + selectQuantity
  273. if totalQuantities > 4 {
  274. selectQuantity = 4 - global.actor2Items[0,1];
  275. }
  276. }
  277.  
  278. // do the dip
  279. scr_assignItemToActor("actor2",0,global.itemsInDB[global.itemsInBag[itemIndex+pivot,0],0],selectQuantity);
  280.  
  281. break;
  282. }
  283.  
  284. case 3: {
  285. if global.actor3Items[0,0] == global.itemsInDB[global.itemsInBag[itemIndex+pivot,0],0] {
  286. totalQuantities = global.actor3Items[0,1] + selectQuantity
  287. if totalQuantities > 4 {
  288. selectQuantity = 4 - global.actor3Items[0,1];
  289. }
  290. }
  291.  
  292. // do the dip
  293. scr_assignItemToActor("actor3",0,global.itemsInDB[global.itemsInBag[itemIndex+pivot,0],0],selectQuantity);
  294.  
  295. break;
  296. }
  297.  
  298. case 4: {
  299. if global.actor4Items[0,0] == global.itemsInDB[global.itemsInBag[itemIndex+pivot,0],0] {
  300. totalQuantities = global.actor4Items[0,1] + selectQuantity
  301. if totalQuantities > 4 {
  302. selectQuantity = 4 - global.actor4Items[0,1];
  303. }
  304. }
  305.  
  306. // do the dip
  307. scr_assignItemToActor("actor4",0,global.itemsInDB[global.itemsInBag[itemIndex+pivot,0],0],selectQuantity);
  308.  
  309. break;
  310. }
  311.  
  312.  
  313. }
  314.  
  315. if !(global.itemsInBag[0,0] mod 2 == 0){
  316. if maxQuantity = selectQuantity {
  317. if pivot >= 2 {
  318. pivot -= 2;
  319. } else {
  320. if itemIndex > 1 {
  321. itemIndex -= 1
  322. }
  323.  
  324. }
  325. }
  326.  
  327.  
  328. }
  329.  
  330. // reset some variables
  331. selectQuantity = 1;
  332. mode = "selectItem"
  333.  
  334.  
  335.  
  336. // reset all the item data
  337. global.itemsInBag[0,0] = 0; // quantity, use a for
  338. global.itemsInBag[0,1] = 0; // columns args
  339. counter = 1;
  340.  
  341. // put items in bag
  342. for (i=1;i<=global.itemsInDB[0,0];i+=1) {
  343. if global.itemsInDB[i,1] > 0 {
  344.  
  345. global.itemsInBag[counter,0] = global.itemsInDB[i,0]; // id
  346. global.itemsInBag[counter,1] = global.itemsInDB[i,1]; // quantity
  347. global.itemsInBag[counter,2] = global.itemsInDB[i,2]; // name
  348. counter += 1;
  349.  
  350. }
  351. global.itemsInBag[0,0] = counter-1;
  352. }
  353.  
  354. // reduce items to show if you don't have those item quantity
  355. if maxItemsToShow > global.itemsInBag[0,0] {
  356. maxItemsToShow = global.itemsInBag[0,0]
  357. }
  358.  
  359.  
  360.  
  361.  
  362. }
  363.  
  364.  
  365. }
  366.  
  367.  
  368.  
  369.  
  370.  
  371. }
  372.  
  373.  
  374.  
  375. }
  376.  
  377.  
  378.  
  379.  
  380. // FADE ANIM BLOCK
  381. if fade_mode > 0 { // to black
  382. gralAlpha = 0;
  383.  
  384. fade_timer = fade_mode;
  385. fade_mode = -1;
  386. }
  387. if fade_mode = -1 {
  388. if (gralAlpha < 1) {gralAlpha += 0.1;} else {
  389. if fade_switch == 1 {
  390. fade_switch = 0;
  391. o_player.canMove = 1;
  392. } else {
  393. fade_switch = 1;
  394. }
  395. fade_mode = -2;
  396. }
  397. }
  398.  
  399. if fade_mode = -2 {
  400. if (fade_timer > 0) {
  401. fade_timer -= 1;
  402. } else {
  403. if canUseMenu == 1 {
  404. canUseMenu = 0;
  405. } else {
  406. canUseMenu = 1;
  407. }
  408. fade_mode = -3;
  409.  
  410. }
  411.  
  412. }
  413.  
  414. if fade_mode = -3 { // to white
  415. if (gralAlpha > 0) {gralAlpha -= 0.1;} else {
  416. fade_mode = 0;
  417. if canUseMenu == 0 {
  418. instance_destroy();
  419. }
  420.  
  421. }
  422. }
  423. // ///////////////////
  424.  
  425. // if fade_switch == 1 {
  426. // o_player.canMove = 1;
  427. //
  428.  
  429. // }
Add Comment
Please, Sign In to add comment