Advanced input method - HudInput

Moderator: GZDoom Developers

Monsterovich
Posts: 59
Joined: Sat Apr 12, 2014 11:10 am

Advanced input method - HudInput

Post by Monsterovich »

Very often modders want to type strings in acs, but there are no available ways to do this. I made one - HUDInput. This works by the same way as chat, but separated from it.

ACS Reference

Code: Select all

int HudInput(int player, str prompt); // shows input dialog to player with given id (-1 is activator), returns 1 if success, 0 - if not (means that input dialog is already opened or player is chatting) 
int CheckHudInput(int player); // returns 1 if player is typing, else returns 0
str GetHudInputString(int player); // returns string from player input
int GetHudInputInteger(int player); // returns integer from player input (if player typed letters instead of numbers, function will return 0)
fixed GethHudInputFixed(int player); // returns fixed value from player input
void HudInputStop(int player); // closes input dialog
Few Examples:
Spoiler:
zspecial.acs
Spoiler:
Attachments
inputpatch_2.7.1_3.txt
(7.58 KiB) Downloaded 47 times
Last edited by Monsterovich on Tue Aug 05, 2014 11:41 am, edited 3 times in total.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49226
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Advanced input method - HudInput

Post by Graf Zahl »

Please repost the patch as attachment. Directly coming from a

Code: Select all

 section it cannot be applied without errors.
Monsterovich
Posts: 59
Joined: Sat Apr 12, 2014 11:10 am

Re: Advanced input method - HudInput

Post by Monsterovich »

Graf Zahl wrote:Please repost the patch as attachment. Directly coming from a

Code: Select all

 section it cannot be applied without errors.[/quote]

"The extension diff is not allowed."

lol Ok, done.
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: Advanced input method - HudInput

Post by edward850 »

Something about this seems incomplete. I don't see how the text is being handled by the player command buffer.
Edit: Yeah, nothing about this is implemented properly at all.
Last edited by edward850 on Tue Aug 05, 2014 11:03 am, edited 1 time in total.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49226
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Advanced input method - HudInput

Post by Graf Zahl »

Hm. I get this when trying to apply with TortoiseGit:
Patch format detection failed.

Fail
How did you create this patch?
Monsterovich
Posts: 59
Joined: Sat Apr 12, 2014 11:10 am

Re: Advanced input method - HudInput

Post by Monsterovich »

Graf Zahl wrote:Hm. I get this when trying to apply with TortoiseGit:
Patch format detection failed.

Fail
How did you create this patch?
diff -c ./zdoombak/src/ ./zdoom/src/ > inputpatch_2.7.1_2.diff

Stupid question. Have you renamed it to .diff? :P Or this is not important?
Last edited by Monsterovich on Thu Jan 08, 2015 1:49 pm, edited 3 times in total.
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: Advanced input method - HudInput

Post by edward850 »

I literally cannot understand what's going on with this code. You define player numbers in your "specifications" but otherwise never use them. You only ever pull the string/chatmode from the local session, and the string can only ever be created by the local session. It never even touches player commands, which makes it beyond unusable in almost every test case I can think of.

Demos and netgames be damned. Which is completely absurd for something that uses player numbers as part of its spec.
Edward-san
Posts: 1774
Joined: Sat Oct 17, 2009 9:40 am

Re: Advanced input method - HudInput

Post by Edward-san »

Please use 'diff -u' instead of 'diff -c'. This is because the patch format is not compatible with git.
User avatar
GooberMan
Posts: 1336
Joined: Fri Aug 08, 2003 12:57 am
Location: Helsinki, Finland

Re: Advanced input method - HudInput

Post by GooberMan »

I want to know what general purpose need this fills (since the OP claimed such things) and why a raw input reader in ACS wouldn't be a better idea.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49226
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Advanced input method - HudInput

Post by Graf Zahl »

edward850 wrote:I literally cannot understand what's going on with this code. You define player numbers in your "specifications" but otherwise never use them. You only ever pull the string/chatmode from the local session, and the string can only ever be created by the local session. It never even touches player commands, which makes it beyond unusable in almost every test case I can think of.

Demos and netgames be damned. Which is completely absurd for something that uses player numbers as part of its spec.

Ok, that decides it. After reading this I had a closer look at the code and you are correct. This neither works with demos nor with multiplayer. Sorry, can't be added as-is.
User avatar
Nash
 
 
Posts: 17487
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Advanced input method - HudInput

Post by Nash »

Would be useful actually (I have at least 3 major uses for this if this were implemented) but I guess the implementation is incomplete. Once demo, save-game and multiplayer compatibility is properly worked out, I'm sure it'd be decent for inclusion.

Example usage: text entry with keyboard instead of ACS-based mouse-driven on-screen keyboard . For in-game journals, question/answer stuff, etc.
User avatar
GooberMan
Posts: 1336
Joined: Fri Aug 08, 2003 12:57 am
Location: Helsinki, Finland

Re: Advanced input method - HudInput

Post by GooberMan »

Well, I won't go in to a stylistic discussion there.

But needless to say, there's far nicer ways to get keyboard input there than hacking in to the chat functionality. I'd rather a full-fledged API that has properly thought things through than something that essentially replicates the BASIC prompts you used to type in to C64s in stores back in the day.
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: Advanced input method - HudInput

Post by edward850 »

Basically, yeah. That's the other problem I had with this. It's rather kludged in with a function that made little sense from a user standpoint (why the chatmesseage function? Especially if you're not actually chatting to something), and it incorrectly assumed that players would always have some form of keyboard input (which is kind of a bad thing to assume these days).

It does make me wonder if it would be worth adding the virtual keyboard to the chatmessage function, though. :P
Monsterovich
Posts: 59
Joined: Sat Apr 12, 2014 11:10 am

Re: Advanced input method - HudInput

Post by Monsterovich »

Graf Zahl wrote:
edward850 wrote:I literally cannot understand what's going on with this code. You define player numbers in your "specifications" but otherwise never use them. You only ever pull the string/chatmode from the local session, and the string can only ever be created by the local session. It never even touches player commands, which makes it beyond unusable in almost every test case I can think of.

Demos and netgames be damned. Which is completely absurd for something that uses player numbers as part of its spec.
This neither works with demos nor with multiplayer. Sorry, can't be added as-is.
You closed suggestion faster than I posted new comment. I made new version of patch that could help in netgames. I just added hud information to player's object.
Hope, this helps.
Last edited by Monsterovich on Thu Jan 08, 2015 1:49 pm, edited 3 times in total.
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: Advanced input method - HudInput

Post by edward850 »

You don't even know what you are doing, do you? This fixes absolutely nothing about the issues pointed out. The Input still doesn't touch the player command buffer, and it will still break horribly in demos (I'm not sure how amused I'm supposed to be at the chat dialog popping up during demo playback).

And it's still pretty much the wrong way to go about any of this.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”