"Get available levels" from ZScript

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: "Get available levels" from ZScript

Re: "Get available levels" from ZScript

by Nash » Thu Oct 21, 2021 10:08 am

You can now use the LevelInfo struct for this. The 'Level' global has an 'info' member that can be easily accessed. See this file for some examples.

Re: "Get available levels" from ZScript

by Graf Zahl » Sun Jul 05, 2020 11:57 pm

That'd be a very inefficient way to handle this - you need 3 parsers that need to be kept up to date with the internal ones.

Re: "Get available levels" from ZScript

by 3saster » Sun Jul 05, 2020 7:59 pm

While the feature could certainly be useful, you could write a parser that reads the MAPINFO lumps and parses them to extract what the map name is. I may try this out later, sounds like it could be an interesting task.

Re: "Get available levels" from ZScript

by Accensus » Thu Jul 02, 2020 6:23 pm

Christ, today is one of those days where I spend exactly 0 seconds thinking before posting. To redeem myself, I second this feature suggestion, as it'd allow the creation of map selector mods, like a PDA that allows you to exit early. Maybe I could revise my hub idea too. Just need to figure out what to do about the cluster text...

Re: "Get available levels" from ZScript

by JPL » Thu Jul 02, 2020 5:39 pm

Accensus wrote:NextMap is a string, meaning you'd have to hardcode the list. There's currently no way to get the name of an arbitrary map at runtime.
Right, that's what I'm asking for: a way, from ZScript, to get an array of valid map names based on the currently loaded WADs. As far as I can tell there is no way to do this.

Re: "Get available levels" from ZScript

by Accensus » Thu Jul 02, 2020 12:38 pm

NextMap is a string, meaning you'd have to hardcode the list. There's currently no way to get the name of an arbitrary map at runtime.

Re: "Get available levels" from ZScript

by JPL » Thu Jul 02, 2020 11:55 am

Caligari87 wrote:
JPL wrote:It'd also be nice to not have to involve any ACS, and have the equivalent of ACS ChangeLevel in ZScript, but I can file that as a separate request if need be.
Reasonably sure this part can be done in zscript by (roughly) setting level.nextmap and then calling level.ExitLevel() (there's probably slightly more to it than that, but it's the basic gist).
8-)
How do I know which levels are actually valid though? A WAD might have 9 levels, 32 levels, or something else. They might be called ExMx, MAPxx, or something else.

Now that I think of it, an optional bool argument for my original request that specifies "get all available levels, including IWAD levels" vs "get only levels defined in loaded PWADs" would be useful. If a PWAD includes MAP01 through MAP03, I don't want the random pick to come up a vanilla MAP15, for example.

Re: "Get available levels" from ZScript

by Accensus » Thu Jul 02, 2020 9:08 am

That would work. But keep in mind that if you jump to a map outside of the cluster, you'll have to watch the cluster text every time. I learned this when trying to make an intermission map addon that could be used with any mapset, but unfortunately it didn't work and the cluster thing completely ruined the immersion.

Re: "Get available levels" from ZScript

by Caligari87 » Thu Jul 02, 2020 8:27 am

JPL wrote:It'd also be nice to not have to involve any ACS, and have the equivalent of ACS ChangeLevel in ZScript, but I can file that as a separate request if need be.
Reasonably sure this part can be done in zscript by (roughly) setting level.nextmap and then calling level.ExitLevel() (there's probably slightly more to it than that, but it's the basic gist).

8-)

"Get available levels" from ZScript

by JPL » Wed Jul 01, 2020 3:22 pm

I'd like to make a generic randomizer mod that, among other things, exits any level to a random level instead of the one defined by "next" / "secretnext" in MAPINFO. The actual level transition I think I can do with the ACS function ChangeLevel, but I don't think ZScript has a way of getting a list (dynarray of strings?) of all available levels, ie all levels in currently loaded IWADs and PWADs, sort of like what you get with the "listmaps" console command. Not sure if this would be part of the "Wads" ZScript function group or something else, that's an implementation decision.

Edit based on some discussion below: for this to be most useful, it would be good to have an optional bool argument to pass in to this function that specifies whether to return an array of all levels including ones defined in the IWAD, or just the levels that are defined in PWADs.

It'd also be nice to not have to involve any ACS, and have the equivalent of ACS ChangeLevel in ZScript, but I can file that as a separate request if need be.

Top