Text-script triggered but doesn't work

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

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.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
IgnyteZero
Posts: 18
Joined: Thu Jan 16, 2025 12:17 pm
Operating System Version (Optional): Windows 10

Text-script triggered but doesn't work

Post by IgnyteZero »

Ok, so in my map when one moster dies, another monster teleports (activated) to a certain point. As it arrives there it triggers several linedefs related to three different scripts. One of them is a text-script supposed to give a headsup to the player of what's going on. Now all three linedefs trigger correctly, this I've checked, but the text one still doesn't print the text for the players to read. This confuses me a lot. As I've said, I've checked so that it actually triggers by deliberately having the linedef refer to a non-existent script, which gives me an error message ingame when it occurs. Any other text message scripted in the same way works correctly. Does the Print or Hudmessage commands have a proximity limit? Is that my issue? How would I go about to solve that? Or do anyone have a better solution that works?

Anyway, I first tried using Print, using the following code:

Code: Select all

script 1 (void){					//Level 8 Text
		Print(s:"\cfWhatever text");
}
Then, having no result with that I tried Hudmessage:

Code: Select all

script 1 (void){					//Level 8 Text
		Hudmessage(s:"Whatever text"; HUDMSG_PLAIN, 1, CR_GOLD, 0.5, 0.5, 4.0);
}
User avatar
SPZ1
Posts: 381
Joined: Wed Aug 02, 2017 3:01 pm
Location: Illinois

Re: Text-script triggered but doesn't work

Post by SPZ1 »

Try using PrintBold or HUDMessageBold. If a monster is triggering a script, the message would be only printed to the activator which in this case is the monster.
IgnyteZero
Posts: 18
Joined: Thu Jan 16, 2025 12:17 pm
Operating System Version (Optional): Windows 10

Re: Text-script triggered but doesn't work

Post by IgnyteZero »

SPZ1 wrote: Wed Feb 12, 2025 8:00 pm Try using PrintBold or HUDMessageBold. If a monster is triggering a script, the message would be only printed to the activator which in this case is the monster.
Ah, thanks. That explains it. I'll try that.
IgnyteZero
Posts: 18
Joined: Thu Jan 16, 2025 12:17 pm
Operating System Version (Optional): Windows 10

Re: Text-script triggered but doesn't work

Post by IgnyteZero »

Works perfect now! Superthanks!
IgnyteZero
Posts: 18
Joined: Thu Jan 16, 2025 12:17 pm
Operating System Version (Optional): Windows 10

Re: Text-script triggered but doesn't work

Post by IgnyteZero »

Ok, so using HudMessageBold worked great. But I suddenly ran into another problem with HudMessage on another map level.

I get these weird errors in UDB's script-editor:

* hudmsg_plain: Identifer has not been detected

or

* Unknown cast type in print statement
* Missing colon

The script looks like this. It's the exact script copypasted. I cannot perceive anything wrong with it.

Code: Select all

script 7 (void){					//Test
			//void HudMessage (text; int type, int id, int color, fixed x, fixed y, fixed holdTime [, fixed alpha]);
		HudMessage("AAAAAAAAAAAAA"; HUDMSG_PLAIN, 0, CR_GOLD, 0.5, 0.5, 4);
}
Heisanevilgenius
Posts: 85
Joined: Wed Dec 15, 2021 8:38 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: Text-script triggered but doesn't work

Post by Heisanevilgenius »

You forgot the "s:"

Code: Select all

HudMessage(s:"AAAAAAAAAAAAA"; HUDMSG_PLAIN, 0, CR_GOLD, 0.5, 0.5, 4);
IgnyteZero
Posts: 18
Joined: Thu Jan 16, 2025 12:17 pm
Operating System Version (Optional): Windows 10

Re: Text-script triggered but doesn't work

Post by IgnyteZero »

Ahhh... such a simple mistake... I got snowblind apparently
IgnyteZero
Posts: 18
Joined: Thu Jan 16, 2025 12:17 pm
Operating System Version (Optional): Windows 10

Re: Text-script triggered but doesn't work

Post by IgnyteZero »

Okey, still adding the missing "s:" I get the "* hudmsg_plain: Identifer has not been detected" error. The strangest thing is it works on another level in my wad, but not on this specific level. I have copied it, rewritten it, everything, a thousand times. Still get that error.

It's no biggie, as the print command works fine, but I want to add a few more seconds of uptime for the message. So it's quite annoying I can't get it to work. Maybe it's an UDB issue? I don't know.
User avatar
Enjay
 
 
Posts: 26879
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Text-script triggered but doesn't work

Post by Enjay »

I assume that it is there is other things are working but, just to check, do you have:
#include "zcommon.acs"
at the top of your scripts lump?

If it's not, then add it.

If it is there, post your whole scripts lump and it should be possible to figure out what the problem is.
IgnyteZero
Posts: 18
Joined: Thu Jan 16, 2025 12:17 pm
Operating System Version (Optional): Windows 10

Re: Text-script triggered but doesn't work

Post by IgnyteZero »

Enjay wrote: Tue Mar 04, 2025 1:00 pm I assume that it is there is other things are working but, just to check, do you have:
#include "zcommon.acs"
at the top of your scripts lump?

If it's not, then add it.

If it is there, post your whole scripts lump and it should be possible to figure out what the problem is.
Ah, that was it. Somehow I had omitted that in just that lump for that level.

I don't have that many scripts on my levels, mostly Print commands, and they seem to work without it.

Awesome! Thanks.

Return to “Scripting”