Advertisement
Dev

WaW Menu Base To Learn From and Use

Dev
Jul 23rd, 2015
29,375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.75 KB | None | 0 0
  1. #include common_scripts\utility;
  2. #include maps\_utility;
  3.  
  4. doTehRobot()
  5. {
  6.  
  7. self thread MainMenu();
  8. self thread hoverselect();
  9. self thread hover();
  10. self thread hoveropts();
  11. self thread MonitorButtons();
  12. }
  13.  
  14. MainMenu()
  15. {
  16. self endon ("death");
  17. self.ariz=0;
  18. self.opts = strTok("SubMenu 1|SubMenu 2|SubMenu 3|SubMenu 4|SubMenu 5|SubMenu 6|SubMenu 7|SubMenu 8", "|");
  19. for(;;)
  20. {
  21. self waittill("frag");
  22. self thread fade_to_black();
  23. self freezecontrols(true);
  24. self.ariz=1;
  25. for(x=0; x<=self.opts.size; x++)
  26. {
  27. self.display[x] = self createFontString( "objective", 2.0, self );
  28. self.display[x].sort = 100;
  29. self.display[x] setPoint("RIGHT", "CENTER", 0, x*30-100 );
  30. self.display[x] setText("^1"+self.opts[x]);
  31. }
  32. self waittill("melee");
  33. if( self.ariz==1)
  34. {
  35. self notify("FadeDone");
  36. self freezecontrols(false);
  37. self.ariz=0;
  38. for(x=0; x<=self.opts.size; x++)
  39. {
  40. self.display[x] destroy();
  41. }
  42. }
  43. }
  44. }
  45.  
  46. hover()
  47. {
  48. self endon ("death");
  49. for(;;)
  50. {
  51. self waittill("attack");
  52. self.hover += 1;
  53. if( self.hover>=self.opts.size)
  54. {
  55. self.hover = 0;
  56. }
  57. for(x=0; x<=self.opts.size; x++)
  58. {
  59. self.display[x] setText("^7"+self.opts[x]); // Color when Not Selected
  60. }
  61. self.display[self.hover] setText("^2"+self.opts[self.hover]); // Color when Hovered
  62. }
  63. }
  64.  
  65. hoveropts()
  66. {
  67. self endon ( "death" );
  68. for(;;)
  69. {
  70. self waittill("ads");
  71. self.hover -= 1;
  72. if( self.hover<0)
  73. {
  74. self.hover = self.opts.size-1;
  75. }
  76. for(x=0; x<=self.opts.size; x++)
  77. {
  78. self.display[x] setText("^7"+self.opts[x]); // Color when Not Selected
  79. }
  80. self.display[self.hover] setText("^4"+self.opts[self.hover]); // Color when Hovered
  81. }
  82. }
  83.  
  84. hoverselect()
  85. {
  86. self endon ( "disconnect" );
  87. for(;;)
  88. {
  89. self waittill("use");
  90. if( self.ariz==1)
  91. {
  92. self thread Functions();
  93. }
  94. }
  95. }
  96.  
  97. fade_to_black()
  98. {
  99. fadetoblack = NewHudElem();
  100. fadetoblack.x = 50;
  101. fadetoblack.y = 50;
  102. fadetoblack.alpha = 0;
  103. fadetoblack.horzAlign = "RIGHT";
  104. fadetoblack.vertAlign = "CENTER";
  105. fadetoblack.sort = -1000;
  106. fadetoblack SetShader( "black", 640, 480 );
  107. fadetoblack FadeOverTime( 1.0 );
  108. fadetoblack.alpha = 1;
  109. self waittill( "FadeDone" );
  110. fadetoblack FadeOverTime( 1.0 );
  111. fadetoblack.alpha = 0;
  112. }
  113.  
  114. MonitorButtons()
  115. {
  116. self endon("death");
  117. self endon("disconnect");
  118. for(;;)
  119. {
  120. if(self FragButtonPressed())
  121. {
  122. self notify("frag");
  123. }
  124. if(self MeleeButtonPressed())
  125. {
  126. self notify("melee");
  127. }
  128. if(self AttackButtonPressed())
  129. {
  130. self notify("attack");
  131. }
  132. if(self AdsButtonPressed())
  133. {
  134. self notify("ads");
  135. }
  136. if(self UseButtonPressed())
  137. {
  138. self notify("use");
  139. }
  140. wait .17;
  141. }
  142. }
  143. MeleeOptions()
  144. {
  145. self waittill( "melee" );
  146. self notify( "Close_Sub_Menu" );
  147. self thread ReloadOptions();
  148. self thread MainMenu();
  149. }
  150. ReloadOptions()
  151. {
  152. self thread MeleeOptions();
  153. for(x=0; x<=self.opts.size; x++)
  154. {
  155. self.display[x] destroy();
  156. }
  157. for(x=0; x<=self.opts.size; x++)
  158. {
  159. self.display[x] = self createFontString( "objective", 2.0 );
  160. self.display[x].sort = 100;
  161. self.display[x] setPoint("CENTER", "CENTER", 0, x*30-100 );
  162. self.display[x] setText("^4"+self.opts[x]);
  163. }
  164. }
  165. Functions()
  166. {
  167. self endon( "Close_Main_Menu" ); //Notify this or you'll have problems
  168. switch(self.hover)
  169. {
  170. case 0:
  171. self.opts = strTok("Option 1|Option 2|Option 3|Option 4|Option 5|Option 6|Option 7|Option 8", "|"); //Sub Menu 1
  172. self thread ReloadOptions();
  173. self thread SubMenu1Options();
  174. break;
  175. case 1:
  176. self.opts = strTok("Option 1|Option 2|Option 3|Option 4|Option 5|Option 6|Option 7|Option 8", "|"); //Sub Menu 2
  177. self thread ReloadOptions();
  178. self thread SubMenu2Options();
  179. break;
  180. case 2:
  181. self.opts = strTok("Option 1|Option 2|Option 3|Option 4|Option 5|Option 6|Option 7|Option 8", "|"); //Sub Menu 3
  182. self thread ReloadOptions();
  183. self thread SubMenu3Options();
  184. break;
  185. case 3:
  186. self.opts = strTok("Option 1|Option 2|Option 3|Option 4|Option 5|Option 6|Option 7|Option 8", "|"); //Sub Menu 4
  187. self thread ReloadOptions();
  188. self thread SubMenu4Options();
  189. break;
  190. case 4:
  191. self.opts = strTok("Option 1|Option 2|Option 3|Option 4|Option 5|Option 6|Option 7|Option 8", "|"); //Sub Menu 5
  192. self thread ReloadOptions();
  193. self thread SubMenu5Options();
  194. break;
  195. case 5:
  196. self.opts = strTok("Option 1|Option 2|Option 3|Option 4|Option 5|Option 6|Option 7|Option 8", "|"); //Sub Menu 6
  197. self thread ReloadOptions();
  198. self thread SubMenu6Options();
  199. break;
  200. case 6:
  201. self.opts = strTok("Option 1|Option 2|Option 3|Option 4|Option 5|Option 6|Option 7|Option 8", "|"); //Sub Menu 7
  202. self thread ReloadOptions();
  203. self thread SubMenu7Options();
  204. break;
  205. case 7:
  206. self.opts = strTok("Option 1|Option 2|Option 3|Option 4|Option 5|Option 6|Option 7|Option 8", "|"); //Sub Menu 8
  207. self thread ReloadOptions();
  208. self thread SubMenu8Options();
  209. break;
  210. default:
  211. self.opts = strTok("Option 1|Option 2|Option 3|Option 4|Option 5|Option 6|Option 7|Option 8", "|"); //Sub Menu 9
  212. self thread ReloadOptions();
  213. self thread SubMenu9Options();
  214. break;
  215. }
  216. }
  217.  
  218. SubMenu1Options()
  219. {
  220. self notify( "Close_Main_Menu" );
  221. self endon( "Close_Sub_Menu" );
  222. switch(self.hover)
  223. {
  224. case 0:
  225. self iPrintln( "test" ); //Function Here
  226. break;
  227. case 1:
  228. self iPrintln( "test" ); //Function Here
  229. break;
  230. case 2:
  231. self iPrintln( "test" ); //Function Here
  232. break;
  233. case 3:
  234. self iPrintln( "test" ); //Function Here
  235. break;
  236. case 4:
  237. self iPrintln( "test" ); //Function Here
  238. break;
  239. case 5:
  240. self iPrintln( "test" ); //Function Here
  241. break;
  242. case 6:
  243. self iPrintln( "test" ); //Function Here
  244. break;
  245. case 7:
  246. self iPrintln( "test" ); //Function Here
  247. break;
  248. default:
  249. self iPrintln( "test" ); //Function Here
  250. break;
  251. }
  252. }
  253. SubMenu2Options()
  254.  
  255. {
  256. self notify( "Close_Main_Menu" );
  257. self endon( "Close_Sub_Menu" );
  258. switch(self.hover)
  259. {
  260. case 0:
  261. self iPrintln( "test" ); //Function Here
  262. break;
  263. case 1:
  264. self iPrintln( "test" ); //Function Here
  265. break;
  266. case 2:
  267. self iPrintln( "test" ); //Function Here
  268. break;
  269. case 3:
  270. self iPrintln( "test" ); //Function Here
  271. break;
  272. case 4:
  273. self iPrintln( "test" ); //Function Here
  274. break;
  275. case 5:
  276. self iPrintln( "test" ); //Function Here
  277. break;
  278. case 6:
  279. self iPrintln( "test" ); //Function Here
  280. break;
  281. case 7:
  282. self iPrintln( "test" ); //Function Here
  283. break;
  284. default:
  285. self iPrintln( "test" ); //Function Here
  286. break;
  287. }
  288. }
  289. SubMenu3Options()
  290.  
  291. {
  292. self notify( "Close_Main_Menu" );
  293. self endon( "Close_Sub_Menu" );
  294. switch(self.hover)
  295. {
  296. case 0:
  297. self iPrintln( "test" ); //Function Here
  298. break;
  299. case 1:
  300. self iPrintln( "test" ); //Function Here
  301. break;
  302. case 2:
  303. self iPrintln( "test" ); //Function Here
  304. break;
  305. case 3:
  306. self iPrintln( "test" ); //Function Here
  307. break;
  308. case 4:
  309. self iPrintln( "test" ); //Function Here
  310. break;
  311. case 5:
  312. self iPrintln( "test" ); //Function Here
  313. break;
  314. case 6:
  315. self iPrintln( "test" ); //Function Here
  316. break;
  317. case 7:
  318. self iPrintln( "test" ); //Function Here
  319. break;
  320. default:
  321. self iPrintln( "test" ); //Function Here
  322. break;
  323. }
  324. }
  325. SubMenu4Options()
  326.  
  327. {
  328. self notify( "Close_Main_Menu" );
  329. self endon( "Close_Sub_Menu" );
  330. switch(self.hover)
  331. {
  332. case 0:
  333. self iPrintln( "test" ); //Function Here
  334. break;
  335. case 1:
  336. self iPrintln( "test" ); //Function Here
  337. break;
  338. case 2:
  339. self iPrintln( "test" ); //Function Here
  340. break;
  341. case 3:
  342. self iPrintln( "test" ); //Function Here
  343. break;
  344. case 4:
  345. self iPrintln( "test" ); //Function Here
  346. break;
  347. case 5:
  348. self iPrintln( "test" ); //Function Here
  349. break;
  350. case 6:
  351. self iPrintln( "test" ); //Function Here
  352. break;
  353. case 7:
  354. self iPrintln( "test" ); //Function Here
  355. break;
  356. default:
  357. self iPrintln( "test" ); //Function Here
  358. break;
  359. }
  360. }
  361. SubMenu5Options()
  362.  
  363. {
  364. self notify( "Close_Main_Menu" );
  365. self endon( "Close_Sub_Menu" );
  366. switch(self.hover)
  367. {
  368. case 0:
  369. self iPrintln( "test" ); //Function Here
  370. break;
  371. case 1:
  372. self iPrintln( "test" ); //Function Here
  373. break;
  374. case 2:
  375. self iPrintln( "test" ); //Function Here
  376. break;
  377. case 3:
  378. self iPrintln( "test" ); //Function Here
  379. break;
  380. case 4:
  381. self iPrintln( "test" ); //Function Here
  382. break;
  383. case 5:
  384. self iPrintln( "test" ); //Function Here
  385. break;
  386. case 6:
  387. self iPrintln( "test" ); //Function Here
  388. break;
  389. case 7:
  390. self iPrintln( "test" ); //Function Here
  391. break;
  392. default:
  393. self iPrintln( "test" ); //Function Here
  394. break;
  395. }
  396. }
  397. SubMenu6Options()
  398.  
  399. {
  400. self notify( "Close_Main_Menu" );
  401. self endon( "Close_Sub_Menu" );
  402. switch(self.hover)
  403. {
  404. case 0:
  405. self iPrintln( "test" ); //Function Here
  406. break;
  407. case 1:
  408. self iPrintln( "test" ); //Function Here
  409. break;
  410. case 2:
  411. self iPrintln( "test" ); //Function Here
  412. break;
  413. case 3:
  414. self iPrintln( "test" ); //Function Here
  415. break;
  416. case 4:
  417. self iPrintln( "test" ); //Function Here
  418. break;
  419. case 5:
  420. self iPrintln( "test" ); //Function Here
  421. break;
  422. case 6:
  423. self iPrintln( "test" ); //Function Here
  424. break;
  425. case 7:
  426. self iPrintln( "test" ); //Function Here
  427. break;
  428. default:
  429. self iPrintln( "test" ); //Function Here
  430. break;
  431. }
  432. }
  433. SubMenu7Options()
  434.  
  435. {
  436. self notify( "Close_Main_Menu" );
  437. self endon( "Close_Sub_Menu" );
  438. switch(self.hover)
  439. {
  440. case 0:
  441. self iPrintln( "test" ); //Function Here
  442. break;
  443. case 1:
  444. self iPrintln( "test" ); //Function Here
  445. break;
  446. case 2:
  447. self iPrintln( "test" ); //Function Here
  448. break;
  449. case 3:
  450. self iPrintln( "test" ); //Function Here
  451. break;
  452. case 4:
  453. self iPrintln( "test" ); //Function Here
  454. break;
  455. case 5:
  456. self iPrintln( "test" ); //Function Here
  457. break;
  458. case 6:
  459. self iPrintln( "test" ); //Function Here
  460. break;
  461. case 7:
  462. self iPrintln( "test" ); //Function Here
  463. break;
  464. default:
  465. self iPrintln( "test" ); //Function Here
  466. break;
  467. }
  468. }
  469. SubMenu8Options()
  470.  
  471. {
  472. self notify( "Close_Main_Menu" );
  473. self endon( "Close_Sub_Menu" );
  474. switch(self.hover)
  475. {
  476. case 0:
  477. self iPrintln( "test" ); //Function Here
  478. break;
  479. case 1:
  480. self iPrintln( "test" ); //Function Here
  481. break;
  482. case 2:
  483. self iPrintln( "test" ); //Function Here
  484. break;
  485. case 3:
  486. self iPrintln( "test" ); //Function Here
  487. break;
  488. case 4:
  489. self iPrintln( "test" ); //Function Here
  490. break;
  491. case 5:
  492. self iPrintln( "test" ); //Function Here
  493. break;
  494. case 6:
  495. self iPrintln( "test" ); //Function Here
  496. break;
  497. case 7:
  498. self iPrintln( "test" ); //Function Here
  499. break;
  500. default:
  501. self iPrintln( "test" ); //Function Here
  502. break;
  503. }
  504. }
  505. SubMenu9Options()
  506.  
  507. {
  508. self notify( "Close_Main_Menu" );
  509. self endon( "Close_Sub_Menu" );
  510. switch(self.hover)
  511. {
  512. case 0:
  513. self iPrintln( "test" ); //Function Here
  514. break;
  515. case 1:
  516. self iPrintln( "test" ); //Function Here
  517. break;
  518. case 2:
  519. self iPrintln( "test" ); //Function Here
  520. break;
  521. case 3:
  522. self iPrintln( "test" ); //Function Here
  523. break;
  524. case 4:
  525. self iPrintln( "test" ); //Function Here
  526. break;
  527. case 5:
  528. self iPrintln( "test" ); //Function Here
  529. break;
  530. case 6:
  531. self iPrintln( "test" ); //Function Here
  532. break;
  533. case 7:
  534. self iPrintln( "test" ); //Function Here
  535. break;
  536. default:
  537. self iPrintln( "test" ); //Function Here
  538. break;
  539. }
  540. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement