get map name in zscript?

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.

get map name in zscript?

Postby ramon.dexter » Mon Sep 13, 2021 11:52 am

Okay, another one. I want to modify the strife popups, use one of the popups that is obsolete in my mod to display, let's say, a world map.
Now, I know how to draw images on statusbar in zscript, that's not the case.
The case is: How do I get a map name in zscript? I found out that there is a native readonly String MapName. How do I access it in statusbar?
User avatar
ramon.dexter
rudebwoy
 
Joined: 20 Oct 2015
Location: Kozolupy, Bohemia
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: get map name in zscript?

Postby Jarewill » Mon Sep 13, 2021 12:08 pm

You could try using level.MapName, though I'm unsure if that would work.
But things like levelnum and total/killed_monsters work, so I would think level.MapName works too.
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: get map name in zscript?

Postby ramon.dexter » Mon Sep 13, 2021 12:16 pm

Ok, will try. :wink: Thanks again.

edit: Little clarification for those who are interested:

level.MapName returns the name of the map (for example: E1M1, MAP01, and so on).

level.FormatMapName(2) (number is a color number, 2 is white) returns name defined in mapinfo here:
Code: Select allExpand view
map MAP1001 lookup MAP1001_NAME
{
   skybox = Sky4
   //sky1 = sky5
   cluster = 1
   music = 08DSRT1
   outsidefogdensity = 128
   skyfog = 255
   lightmode = 2
   StrifeFallingDamage
   MonsterFallingDamage
   AllowJump
   AllowCrouch
   AllowFreelook
}


So, for this case, level.FormatMapName() returns the MAP1001_NAME (string, defined in language), which is, in this case, "Ranger base".

Hope this helps somebody.
User avatar
ramon.dexter
rudebwoy
 
Joined: 20 Oct 2015
Location: Kozolupy, Bohemia
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support


Return to Scripting

Who is online

Users browsing this forum: eharper256 and 0 guests