ACS Get level name and level lump name

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: ACS Get level name and level lump name

Re: ACS Get level name and level lump name

by ibm5155 » Fri Oct 09, 2015 9:39 am

weird, I remember that doing that in skulltag would result in a yesno string, but if you subtract it, it would Always be " "
but, this is not skulltag :geek:

Re: ACS Get level name and level lump name

by Xaser » Fri Oct 09, 2015 8:15 am

The issue is the opposite: Without use of StrParam, trying to do strings[0]+strings[1] in the example above would yield "E1M1", not "YESNO", because internally you're adding two integers together.

Re: ACS Get level name and level lump name

by ibm5155 » Fri Oct 09, 2015 8:06 am

the way zdoom string Works is really weird, a char atribute would be really welcome.
but from what I understand, is like each string is stored into a single global matrix pointer, so the given number will be just the position of the script on that vector

like
strings[0] = "YES";
strings[1] = "NO;
strings[2[] = "E1M1".

if I remember if you do something like x = string[0]+string[1], x would have the result "YESNO" and it would add a new pointer with the name "YESNO"

Re: ACS Get level name and level lump name

by Nash » Thu Oct 08, 2015 2:29 pm

Yeah! Honestly it still confuses me to this day, I don't think I can fully wrap my head around it.

Re: ACS Get level name and level lump name

by Gez » Thu Oct 08, 2015 2:13 pm

The whole "strings are really integer indices to a string array" thing strikes again! I don't think any mathematical comparison of a StrParam with a constant would ever work as intended.

Re: ACS Get level name and level lump name

by Nash » Thu Oct 08, 2015 1:44 pm

Ah, didn't know that was already readable but... I can't get it to work!

Code: Select all

script "Script_StartGameInstance" Open
{
    str lumpname = StrParam(n: PRINTNAME_LEVEL);
    while (!GameInstanceCount)
    {
        if (lumpname != "TITLEMAP") // this condition is never met
        {
            ACS_NamedExecute("Script_WorldSetup", 0);
            Delay(1); // wait 1 more tic to let the initialization complete
            GameInstanceCount = 1;
        }
        Delay(1);
    }
}
 
EDIT: Nevermind, got it to work! Had to use a handy string compare function from ACSNet and change the condition to this:

Code: Select all

if (!StringCompare(lumpname, StrParam(s: "TITLEMAP")))
 

Re: ACS Get level name and level lump name

by KeksDose » Thu Oct 08, 2015 1:14 pm

strParam appears to be able to do what you are requesting, doesn't it?

Code: Select all

str nicename = strParam(n:PRINTNAME_LEVELNAME);
str lumpname = strParam(n:PRINTNAME_LEVEL);
This only goes for the active map, though. I'm guessing your request goes for any level number?

ACS Get level name and level lump name

by Nash » Thu Oct 08, 2015 1:03 pm

Just ran into a situation where I need this. An ACS function that returns the level name, and the level lump name, as a string.

Currently hacking my way through this by assigning LevelNums to the levels in MAPINFO and just checking against that, but that won't work in the long run!

Top