//---------- Definitions --------------------------- // Console: Menu item type interface with control options // Terminal: Text log interface with limited control options //########## TO DO ############################### // clean up functions // work on code for terminals // limited command line interface // remote access of other terminals // add more comments //********** ZDoom console script 1.0b ************* // This script was written to emulate the menu interfaces found in RTC-3057 // Written by Chris Freund August 4, 5, & 6 2006 // If you choose to use any material contained within please give credit to the // author and leave all coding and comments in place // Notice: This is still a beta, the coding will require further organization. // This script also requires a KEYCONFIG lump entry much like RTC-3057 // Features so far: menus with selectable items // slider control that dims room lights // email me at z34chris@yahoo.com #include "zcommon.acs" // variable list //some of these can be arrays if multiple identical items exist int A; //number of current interface int B; //toggles between prompt and page on terminals int C; //is type console or terminal? int D; //mode--in terminal or not? and how many sub-levels in? int E = 1; //current list item int F; //max list item int G = 4; //slider position int H; //slider original state script 1(int x){ // call this script to print interface text and/or menu items D = 1; A = x; //grab current console number console(A,E); } script 989(void){ //clear screen debug script cleartext(); } script 990(void){ //prompt_up if (D == 1 && E > 1){ E--; console(A,E); } if (D == 2 && G > 1){ G--; slider0(G); } } script 991(void){ //prompt_down if (D == 1 && E < F){ E++; console(A,E); } if (D == 2 && G < F){ G++; slider0(G); } } script 992(void){ //prompt_select switch (D){ //switch case to determine what menu level the player is in case 1: if(A==0 && D == 1 && E == 4){ cleartext(); } if(A==0 && D == 1 && E == 2){ D = 2; //move forward a level in menu F = 7; //set slider to 7 stops H = G; //grab original slider position slider0(G); } break; case 2: if(A==0 && D == 2){ Light_ChangeToValue (1, G*22); //set tagged sector to new light value //use get sector light level in the future D = 1; //move back a level in menu console(A,E); } break; default: hudmessage (s:"script 992 error"; HUDMSG_PLAIN, -1, CR_GOLD, 0.5, 0.5, 1.0); //just in case the switch statement defaults, we will know where it happened } } script 993(void){ //prompt if(A==0 && D == 2){ D = 1; //move back a level G = H; //return to original state console(A,E); } } function void console(int x, int z){ // calls various consoles within a level switch (x){ case 0: F = 4; //set max list items print0(z); break; default: hudmessage (s:"console error"; HUDMSG_PLAIN, -1, CR_GOLD, 0.5, 0.5, 1.0); //just in case the switch statement defaults, we will know where it happened } } function void print0(int x){ switch(x){ //decide which list item to highlite case 1: hudmessage (s:"134.168.192.2 p-term"; HUDMSG_PLAIN, 1, CR_RED, 0.5, 0.2, 0.0); hudmessage (s:"Operate Door"; HUDMSG_PLAIN, 2, CR_WHITE, 0.5, 0.22, 0.0); hudmessage (s:"Adjust Lighting"; HUDMSG_PLAIN, 3, CR_GREEN, 0.5, 0.24, 0.0); hudmessage (s:"coming soon"; HUDMSG_PLAIN, 4, CR_GREEN, 0.5, 0.26, 0.0); hudmessage (s:"Exit"; HUDMSG_PLAIN, 5, CR_GREEN, 0.5, 0.28, 0.0); break; case 2: hudmessage (s:"Operate Door"; HUDMSG_PLAIN, 2, CR_GREEN, 0.5, 0.22, 0.0); hudmessage (s:"Adjust Lighting"; HUDMSG_PLAIN, 3, CR_WHITE, 0.5, 0.24, 0.0); hudmessage (s:"coming soon"; HUDMSG_PLAIN, 4, CR_GREEN, 0.5, 0.26, 0.0); break; case 3: hudmessage (s:"Adjust Lighting"; HUDMSG_PLAIN, 3, CR_GREEN, 0.5, 0.24, 0.0); hudmessage (s:"coming soon"; HUDMSG_PLAIN, 4, CR_WHITE, 0.5, 0.26, 0.0); hudmessage (s:"Exit"; HUDMSG_PLAIN, 5, CR_GREEN, 0.5, 0.28, 0.0); break; case 4: hudmessage (s:"coming soon"; HUDMSG_PLAIN, 4, CR_GREEN, 0.5, 0.26, 0.0); hudmessage (s:"Exit"; HUDMSG_PLAIN, 5, CR_WHITE, 0.5, 0.28, 0.0); break; default: hudmessage (s:"print0 error"; HUDMSG_PLAIN, -1, CR_GOLD, 0.5, 0.5, 1.0); //just in case the switch statement defaults, we will know where it happened } } function void slider0(int x){ switch(x){ case 1: hudmessage (s:"[o------]"; HUDMSG_PLAIN, 3, CR_WHITE, 0.5, 0.24, 0.0); break; case 2: hudmessage (s:"[-o-----]"; HUDMSG_PLAIN, 3, CR_WHITE, 0.5, 0.24, 0.0); break; case 3: hudmessage (s:"[--o----]"; HUDMSG_PLAIN, 3, CR_WHITE, 0.5, 0.24, 0.0); break; case 4: hudmessage (s:"[---o---]"; HUDMSG_PLAIN, 3, CR_WHITE, 0.5, 0.24, 0.0); break; case 5: hudmessage (s:"[----o--]"; HUDMSG_PLAIN, 3, CR_WHITE, 0.5, 0.24, 0.0); break; case 6: hudmessage (s:"[-----o-]"; HUDMSG_PLAIN, 3, CR_WHITE, 0.5, 0.24, 0.0); break; case 7: hudmessage (s:"[------o]"; HUDMSG_PLAIN, 3, CR_WHITE, 0.5, 0.24, 0.0); break; default: hudmessage (s:"slider0 error"; HUDMSG_PLAIN, -1, CR_GOLD, 0.5, 0.5, 1.0); //just in case the switch statement defaults, we will know where it happened } } function void cleartext(void){ // call this to clear the screen of console text A = -1; D = 0; E = 1; F = 0; hudmessage (s:""; HUDMSG_PLAIN, 1, 0, 0, 0, 0); hudmessage (s:""; HUDMSG_PLAIN, 2, 0, 0, 0, 0); hudmessage (s:""; HUDMSG_PLAIN, 3, 0, 0, 0, 0); hudmessage (s:""; HUDMSG_PLAIN, 4, 0, 0, 0, 0); hudmessage (s:""; HUDMSG_PLAIN, 5, 0, 0, 0, 0); }