[ZScript] Tips for menus

Post your example zscripts/ACS scripts/etc here.

[ZScript] Tips for menus

Postby m8f » Sun Dec 01, 2019 11:12 am





What does this do?
This thing displays randomly selected string from a hardcoded list in the main menu.
May come in handy if someone desires to add tips/notes/etc in their mod.

Features:
- compatibility between IWADs and mods
- automatic line breaking (text takes 3/4 of screen width max)
- code can be tuned so text is displayed in other menus
- CVar to toggle on/off (tp_show_notes)

I wonder if it's possible to bypass tt_MenuInjector hack. It's used to run ZScript code before the level is started.
Event handlers, even StaticEventHandler, are registered on level start.

If you are going to use this script, make sure to change tp_ prefix to your own.

Download: https://www.mediafire.com/file/oaj2ajy7 ... 2.pk3/file
Last edited by m8f on Sun Dec 01, 2019 11:09 pm, edited 3 times in total.
User avatar
m8f
the dreamer
 
 
 
Joined: 29 Dec 2017
Discord: m8f#0629
Github ID: mmaulwurff

Re: [ZScript] Tips for menus

Postby Beed28 » Sun Dec 01, 2019 4:03 pm

This sounds super neat! Is it okay if I use some of this in a mod of mine?
User avatar
Beed28
Making entire worlds bounce up and down.
 
Joined: 24 Feb 2013
Location: United Kingdom

Re: [ZScript] Tips for menus

Postby m8f » Sun Dec 01, 2019 10:38 pm

Yes, of course you can. Make sure you change tp_ prefix to your own everywhere, so it won't conflict if someone loads two Tips systems.

I just added a check so if two Tips systems are loaded at the same, only the first is displaying. Please use code from tips-0.2.pk3.
User avatar
m8f
the dreamer
 
 
 
Joined: 29 Dec 2017
Discord: m8f#0629
Github ID: mmaulwurff

Re: [ZScript] Tips for menus

Postby SanyaWaffles » Mon Dec 02, 2019 4:45 am

This is really neat... however I'm having trouble using it in my own project and I can't figure out why.

EDIT: It appears this doesn't work when included in an IPK3 for some reason.
User avatar
SanyaWaffles
Navy Did Nothing Wrong
 
Joined: 25 Apr 2013
Location: Eastern Ohio
Discord: SanyaWaffles#5095
Twitch ID: sanyawaffles
Operating System: Windows 10/8.1/8 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: [ZScript] Tips for menus

Postby m8f » Mon Dec 02, 2019 5:21 am

Is there an error or it just doesn't show the text?

Make sure you integrate all components:
- include .zs file in your zscript lump
- add Injector OptionMenu in menudef
- add a cvar to menudef

It also may not work if you have custom MainMenu. Does your setup have something special in this regard?
User avatar
m8f
the dreamer
 
 
 
Joined: 29 Dec 2017
Discord: m8f#0629
Github ID: mmaulwurff

Re: [ZScript] Tips for menus

Postby SanyaWaffles » Mon Dec 02, 2019 7:48 pm

Even though we solved it I wanna explain what was going on.

It wasn't showing the labels at all. I did edit it to look up text strings as opposed to hardcoded strings. That wasn't what was causing it.

From our discussion this morning/afternoon on Discord it seems it has to do with the order in which my MENUDEF was defined. I had to put it at the very end for it to take effect - after everything else had been stated.

Now it works with a few modifications to make it more appropriate for my project such as changing the font and color and adding a black background to the text to make it easier to read.

This is something I've been wanting for some time, but editing menus is a pain. Thanks for this!
User avatar
SanyaWaffles
Navy Did Nothing Wrong
 
Joined: 25 Apr 2013
Location: Eastern Ohio
Discord: SanyaWaffles#5095
Twitch ID: sanyawaffles
Operating System: Windows 10/8.1/8 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support


Return to Script Library

Who is online

Users browsing this forum: No registered users and 1 guest