[Duplicate] [4.1.0] Orange ZScript console warnings

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

[4.1.0] Orange ZScript console warnings

Postby Undead » Sun Apr 28, 2019 1:25 am

These warnings show up in the console when launching GZDoom 4.1.0. I have no idea if it’s likely to affect gameplay, and it’s probably not a bug per se, but it’s definitely not a nice sight.

Code: Select allExpand view
Script warning, "gzdoom.pk3:zscript/ui/statscreen/statscreen.zs" line 24:
Call to deprecated function CharAt
Script warning, "gzdoom.pk3:zscript/ui/statscreen/statscreen.zs" line 24:
Accessing deprecated function CharAt - deprecated since 4.1.0
Script warning, "gzdoom.pk3:zscript/ui/menu/search/query.zs" line 64:
Call to deprecated function ToLower
Script warning, "gzdoom.pk3:zscript/ui/menu/search/query.zs" line 64:
Accessing deprecated function ToLower - deprecated since 4.1.0
Script warning, "gzdoom.pk3:zscript/ui/menu/search/query.zs" line 65:
Call to deprecated function ToLower
Script warning, "gzdoom.pk3:zscript/ui/menu/search/query.zs" line 65:
Accessing deprecated function ToLower - deprecated since 4.1.0
Script warning, "gzdoom.pk3:zscript/ui/menu/conversationmenu.zs" line 202:
Call to deprecated function CharAt
Script warning, "gzdoom.pk3:zscript/ui/menu/conversationmenu.zs" line 202:
Accessing deprecated function CharAt - deprecated since 4.1.0
Script warning, "gzdoom.pk3:zscript/ui/menu/conversationmenu.zs" line 235:
Call to deprecated function CharAt
Script warning, "gzdoom.pk3:zscript/ui/menu/conversationmenu.zs" line 235:
Accessing deprecated function CharAt - deprecated since 4.1.0
User avatar
Undead
RUS/SRB translator
 
 
 
Joined: 26 Dec 2013
Location: Sweden

Re: [4.1.0] Orange ZScript console warnings

Postby Rachael » Sun Apr 28, 2019 1:31 am

Yikes. This will warrant a 4.1.1 point release.
User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
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: [4.1.0] Orange ZScript console warnings

Postby DoomKrakken » Sun Apr 28, 2019 5:48 pm

Oh yeah, that happened with my mod too...
User avatar
DoomKrakken
All but inactive here on the forums. Contact me on Discord for quicker replies.
 
Joined: 20 Oct 2014
Location: Plahnit Urff
Discord: DoomKrakken#2719

Re: [4.1.0] Orange ZScript console warnings

Postby Matt » Mon Apr 29, 2019 12:47 am

What do we use in place of CharAt and ToLower?

EDIT: I just noticed that no warnings appear for HD's use of the ToLower() function. Is this different?
User avatar
Matt
Putting the XD into *xdeath since 2007
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: [4.1.0] Orange ZScript console warnings

Postby _mental_ » Mon Apr 29, 2019 12:56 am

Matt wrote:What do we use in place of CharAt and ToLower?

ByteAt() and MakeLower().

Matt wrote:I just noticed that no warnings appear for HD's use of the ToLower() function. Is this different?

This depends on ZScript version required for your mod.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: [4.1.0] Orange ZScript console warnings

Postby Lagi » Fri May 29, 2020 12:30 am

how to replace CharAt with BytaAt?

CharAt is a string function, while BytaAt is a int.

int ByteAt (int pos) const

(Need more info)

String CharAt (int pos) const (deprecated)

(Note: this has been deprecated in favor of ByteAt, CodePointCount and GetNextCodePoint.)
Returns the character at the specified position as string.

String s = "abcd";
String chrat = s.CharAt(1); // should be "b"


dont work as expected string
Spoiler:
User avatar
Lagi
 
Joined: 23 Jun 2018
Location: Thou shalt alter thy beliefs with new evidence

Re: [4.1.0] Orange ZScript console warnings

Postby Graf Zahl » Fri May 29, 2020 12:37 am

At the moment you'll have to convert the character back to a string with String.Format("%c", ...), but the main reason these were deprecated is that with Unicode strings such algorithms that pick apart the string character by character won't work as expected and are generally discouraged.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: [4.1.0] Orange ZScript console warnings

Postby Lagi » Fri May 29, 2020 2:03 am

sorry I think its simple, but im defeated by syntax

i have this (it works, just want to remove errors from startup log)
lumpString.CharAt(currentPos)


charAt is now excommunicado, and ByteAt is halal.

so i come up with this :roll:
lumpString.Format("%c", ByteAt(currentPos) )


Spoiler: my logic


and my school teacher said : How can you be so stupid:
Script error, "Bitter Heretic.pk3:zscript/pyw/parse.zsc" line 139:
Call to unknown function 'ByteAt'
User avatar
Lagi
 
Joined: 23 Jun 2018
Location: Thou shalt alter thy beliefs with new evidence

Re: [4.1.0] Orange ZScript console warnings

Postby Graf Zahl » Fri May 29, 2020 3:46 am

Aside from the fact that you just ignored the entire motivation not to access bytes, this doesn't work because you need to specify the string you want to read from.
But your code still isn't Unicode safe and will only work if your text is guaranteed to be ASCII only.

These deprecations were made to clearly show that CharAt is not a safe function in a Unicode environment.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany


Return to Closed Bugs

Who is online

Users browsing this forum: No registered users and 2 guests