ACS & Menus(Bumped - Check 2nd page plz)

Discuss all aspects of editing for ZDoom.
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

ACS & Menus(Bumped - Check 2nd page plz)

Postby Nero » Sun Feb 12, 2012 6:37 am

Alright, so I'm looking to get on the right track in developing an in-game menu that would be linked to a computer terminal. The idea is that a player would approach the terminal and hit their "use" key like normal. The overall effect would vary if use-ability was affected by keys and whatnot. But of course the computer screen would change, likely revealing the menu that I want the player to make selections from. Since this isn't Doom 3 and I don't have the option of a pseudo-mouse menu, I figured I would have a HUD graphic appear that also contained the menu. All of that is straightforward. However the place where I start gibbering to myself is when I try to figure out how to set up option selection. If I have 5 options I could potentially set it up with 5 bind-able keys, but the downside is obvious. You could press those keys anywhere in the map and have the corresponding scripts execute. So that's a fail.

The most likely solution is to use some sort of GetPlayerInput function and aim to make selections based on what keys the player presses, but the problems don't stop there. I would like to enable the mouse in the menu. Now I'm not sure how that would work, because, even if I am using GetPlayerInput and looking for left clicks, how do I know where the player is clicking? For that matter, how would I even get the mouse into the menu? I was aiming to not freeze the player during this, but I think it will be a necessity. I can look for movement keypresses to cancel all of this.

So can anyone get me on the right track here? I really need pointed in the right direction here. I need to know:
1. How to get the mouse into the menu
2. How to determine where the player is clicking (which would then determine what actions are taken)
3. Probably would help to know if any this would work.... :?

Hmm, can't think of anything else I'd need to know :lol:(at the moment anyway). Thanks in advance! :mrgreen:
Last edited by Nero on Sat Oct 27, 2012 6:41 pm, edited 2 times in total.
User avatar
Nero
Royal Boredom....Why can't I do this in Windows?
 
Joined: 06 Sep 2006
Location: Middle of Nowheresville Il.

Re: Getting On the Right Track - ACS & Menus

Postby Jimmy » Sun Feb 12, 2012 8:37 am

I did a menu system of my own, although it didn't have mouse support.

I think what you want is AFADoomer's popup box system. :)

EDIT: Or maybe this. :P
User avatar
Jimmy
º~u~º
 
Joined: 10 Apr 2006
Location: Perth, WA

Re: Getting On the Right Track - ACS & Menus

Postby Nero » Sun Feb 12, 2012 9:27 am

Ah ha!!!!! I knew I wasn't alone in yearning for the ability to do this!!!! Much gratitude your way, Jimmy! Pointed in the direction I have been!

I'm about to turn in for the morning, since I work 3rd shift, but I will be thoroughly examining each of these later when I get up. Thanks, man!!
User avatar
Nero
Royal Boredom....Why can't I do this in Windows?
 
Joined: 06 Sep 2006
Location: Middle of Nowheresville Il.

Re: Getting On the Right Track - ACS & Menus

Postby Nero » Tue Feb 14, 2012 6:44 am

Well, it would appear that I bit off a bit more than I am currently prepared to chew. While I can write ACS for just about anything given patience and time, I'm a mapper, so I've never had a need to do anything like this. I've always been happy staying within the confines of the default GUI. Not anymore though. I need, or at least want this to work so I don't have to find an alternative.

Here is an image of my design. Note however that this is being displayed in the map through a series of HUDMessages instead of being the actual menu at work. This was nothing more than a test for positioning purposes. Sorry that everything is blacked out. The image is a screenshot in-game and I don't want to reveal any more than I have to(yes secret project :wink: ). I thought it might help people understand what I'm talking about. As the image says, each part is its own image. The background is one image(yes slightly translucent 8-) ) That image is displayed first, currently with a negative id number so it displays behind everything else. The next images to pop up are the header and the video feed/screenshot image together. The buttons then display in sequential order, top to bottom. I staggered that a bit for effect. All of this is done through a HUDMSG_FADEINOUT type for the fade-in effect. Lastly once everything is onscreen I replace all of it with a HUDMSG_PLAIN type that has an infinite hold-time. Later, when players select option 5 I'd like to replace the images again with another set of HUDMSG_FADEINOUT types so that the menu will fade out. Also, because I want to use the mouse in this menu, it's important to freeze the player, so I want to be looking for keypresses of the movement keys to also close the menu in conjunction with option 5.

The idea is that will be a bit flexible so that I don't always have to have 5 options when making a menu. Perhaps I only need 3. What then do I do with the number 4 slot? I don't know yet.

So I'm back here for help. Considering the design, would it be possible to make the buttons the only interactive parts of the menu? I'm not interested in being able to move the menu around. It fills the screen just like in the screenshot. I have taken into account different display settings so I have used SetHUDSize to display it at my resolution of 1280x1024. So assuming that I can make the buttons the only interactive part, then how do I do that? I've been looking into AFADoomer's popup box system, but frankly the code is beyond me. I'd post it here, but I'm afraid that might not be kosher without permission. The other suggestions Jimmy made won't work because his is keyboard based and the last option would require me to decompile the ACS, which I don't know how to do or if it's possible to do. So I need some more pointing in the right direction. Perhaps if it is ok to post the code, someone could help me put it into some layman's terms? Anyway, thanks in advance! :)

Oh, one more thing. Since I'm here, I'll just ask before going off to play with this. I'd like the space in the right, lower corner to display a video feed from the location of whatever action is being executed(door opening, lock resetting, ect.). Am I right to assume that simply layering another image of the same size over the square that is a camera texture and has a camera tagged to it would accomplish this goal? It doesn't seem too far fetched, but then again I don't know the full limitations of the HUDMessage system.

edit: removed image(personal thing) 8-)
Last edited by Nero on Sun Feb 26, 2012 10:02 am, edited 1 time in total.
User avatar
Nero
Royal Boredom....Why can't I do this in Windows?
 
Joined: 06 Sep 2006
Location: Middle of Nowheresville Il.

Re: Getting On the Right Track - ACS & Menus

Postby Jimmy » Tue Feb 14, 2012 7:44 am

Sounds like you've got most of your needs covered already, then - it's just the ability to select options with the mouse that you require. :)

Check out Isle's keypad demo (fourth post down), it has a menu that has individual buttons that can be selected with the mouse.
User avatar
Jimmy
º~u~º
 
Joined: 10 Apr 2006
Location: Perth, WA

Re: Getting On the Right Track - ACS & Menus

Postby Nero » Tue Feb 14, 2012 8:41 am

Again you come through, Jimmy! Isle's demo is much simpler and with a bit of tweaking the code will likely work. This will even let me set up my own custom cursor.
User avatar
Nero
Royal Boredom....Why can't I do this in Windows?
 
Joined: 06 Sep 2006
Location: Middle of Nowheresville Il.

Re: Getting On the Right Track - ACS & Menus

Postby Nero » Tue Feb 14, 2012 10:55 am

Ok, so I am at a fair bit of a loss here. This sort of work is not my area of expertise. I'm interested to learn, but I need some help.

edited...

I'm getting the feeling it isn't a good idea to post code that I haven't personally written. I'll work on understanding this a bit better and perhaps post my own for help. I'm not asking someone to write this for me, just for help.
User avatar
Nero
Royal Boredom....Why can't I do this in Windows?
 
Joined: 06 Sep 2006
Location: Middle of Nowheresville Il.

Re: Getting On the Right Track - ACS & Menus

Postby Nero » Sat Feb 25, 2012 6:35 am

So, with a few days break I came back to it and got the mouse cursor to move freely via some minor modifications and a little guesswork. Now I'm at that all-critical stage where I get the buttons to work. That's where I'm stuck now. I think because I'm not sure on the "why" particulars of the range numbers for angle and pitch, other than what math I've done giving me something to work with, I stand little chance of understanding how to calculate where and how the clicking of the buttons is done.

So, in the spoiler is my code. Please note that it is half mine and half Isle's with some of the modifications I've made. I'd like it if anybody could give me a kick in the right direction again(that is to say, what would be the next step?). Take a look at the earlier posts for reference to how the menu should look when it's all going if you need. Thanks for any help! :D

Something else, this comes from a test map I set up so that I don't have to edit a text file, compile it with ACC, and then repackage the whole thing before loading it into the game and running around to the terminal it's used with. The idea is to package this as an add-on like a couple other things. That should explain some of the commenting. Also, I figured I would need some sort of array to feed a function a number when the designated area of the screen is "clicked". That's what the butnum is for, although I haven't added that function yet.

edit: took my code down.
Last edited by Nero on Sun Feb 26, 2012 10:01 am, edited 1 time in total.
User avatar
Nero
Royal Boredom....Why can't I do this in Windows?
 
Joined: 06 Sep 2006
Location: Middle of Nowheresville Il.

Re: Getting On the Right Track - ACS & Menus(Need Help Here)

Postby Nero » Sun Feb 26, 2012 10:00 am

Nevermind, I seem to have gotten it most of the way. It's touchy yet, and doesn't repeat use nice, but you can click on the buttons now.
User avatar
Nero
Royal Boredom....Why can't I do this in Windows?
 
Joined: 06 Sep 2006
Location: Middle of Nowheresville Il.

Re: Getting On the Right Track - ACS & Menus(Need Help Here)

Postby Isle » Sun Feb 26, 2012 4:55 pm

quick question. were you still using the getactorangle one? I've since made an updated one using getplayerinput that doesn't need a "clicker" weapon or a extra camera. I'll post the code to the new one if you want.
User avatar
Isle
WadAuthor 4 L1F3
 
Joined: 21 Nov 2003
Location: Arizona, USA

Re: Getting On the Right Track - ACS & Menus(Need Help Here)

Postby Nero » Sun Feb 26, 2012 11:35 pm

Actually yeah. That's the version Jimmy showed me. It works well, other than I can't get the camera to mirror the player's pitch. Not sure what I'm missing there. So yeah, if you'd post the new code, I'll take a look at it.
User avatar
Nero
Royal Boredom....Why can't I do this in Windows?
 
Joined: 06 Sep 2006
Location: Middle of Nowheresville Il.

Re: Getting On the Right Track - ACS & Menus(Need Help Here)

Postby Isle » Mon Feb 27, 2012 2:20 am

k, heres a quick example wad. no buttons but most of that is the same.
Attachments
PointerBase.zip
(1.48 KiB) Downloaded 17 times
User avatar
Isle
WadAuthor 4 L1F3
 
Joined: 21 Nov 2003
Location: Arizona, USA

Re: Getting On the Right Track - ACS & Menus(Need Help Here)

Postby Nero » Mon Feb 27, 2012 12:33 pm

I got to say that is a thoroughly simpler way of moving the cursor. Figuring out where the clicking was done would be about the same other than I look for input versus weapon fire executing another script. Now am I right to assume that I could close the menu if the player uses the movement controls even though they're frozen? I can't say the player will always be using this is perfect safety so it would be good to be able to close the menu and move quickly if need be.

Something like: if(input_oldbuttons = input_buttons) //blah blah close the menu?

edit:
Oh, and I can use this? Of course credit will be given :D
User avatar
Nero
Royal Boredom....Why can't I do this in Windows?
 
Joined: 06 Sep 2006
Location: Middle of Nowheresville Il.

Re: Getting On the Right Track - ACS & Menus(Need Help Here)

Postby Isle » Mon Feb 27, 2012 8:56 pm

sure you can use it in whatever.

as for exiting:
Code: Select allExpand view
if((getplayerinput(-1, INPUT_BUTTONS) & BT_USE) && !(getplayerinput(-1, INPUT_OLDBUTTONS) & BT_USE))
{
   run = 0;
}
after the click bit would cause it to exit when you hit the use key. but make sure theres a delay(1) somewhere at the start of the script if it's being ran on a USE line or it'll exit right away.
User avatar
Isle
WadAuthor 4 L1F3
 
Joined: 21 Nov 2003
Location: Arizona, USA

Re: Getting On the Right Track - ACS & Menus(Need Help Here)

Postby Nero » Wed Feb 29, 2012 3:03 pm

Isle, dude your second version works awesome!!! Thank you so much! It completely solved the problem with reusing the menu! Thanks again!!!!! :D

edit:

Actually I'm a bit unclear on what you mean on the exit code. I'm not sure where to put it.
User avatar
Nero
Royal Boredom....Why can't I do this in Windows?
 
Joined: 06 Sep 2006
Location: Middle of Nowheresville Il.

Next

Return to Editing

Who is online

Users browsing this forum: jpalomo, Mikk-, PermaNoob and 3 guests