Page 1 of 1

[ZScript] Tips for menus

PostPosted: Sun Dec 01, 2019 10:12 am
by m8f

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.

- 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: ... 2.pk3/file

Re: [ZScript] Tips for menus

PostPosted: Sun Dec 01, 2019 3:03 pm
by Beed28
This sounds super neat! Is it okay if I use some of this in a mod of mine?

Re: [ZScript] Tips for menus

PostPosted: Sun Dec 01, 2019 9:38 pm
by m8f
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.

Re: [ZScript] Tips for menus

PostPosted: Mon Dec 02, 2019 3:45 am
by SanyaWaffles
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.

Re: [ZScript] Tips for menus

PostPosted: Mon Dec 02, 2019 4:21 am
by m8f
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?

Re: [ZScript] Tips for menus

PostPosted: Mon Dec 02, 2019 6:48 pm
by SanyaWaffles
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!