The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] Strange BUG in the STRING read
Author Message
Jhobean
Journeyman
*

Posts: 98
Likes Given: 11
Likes Received: 9 in 3 posts
Joined: Jun 2019
Reputation: 2



Post: #1
[SOLVED] Strange BUG in the STRING read
It's look like 56d not able to read a string on a string..

I don't know how explain the bug but here the code. and the GITHUB issue too

Thx for your help.


https://github.com/Sphereserver/Source/issues/214

In 56d the resuslt is 0

In X, the result is 500


Code:
[DEFNAME achievement_def]

achievement_1_1_palier20 = 500


[FUNCTION test]
src.clearctags
src.ctag0.achievement_1_1_palier = 20
src.sysmessage <eval <DEF.achievement_1_1_palier<src.ctag0.achievement_1_1_palier>>>
(This post was last modified: 11-20-2019 11:49 PM by Jhobean.)
11-20-2019 12:43 PM
Find all posts by this user Like Post Quote this message in a reply
golfin
Banned

Posts: 213
Likes Given: 2
Likes Received: 32 in 28 posts
Joined: Nov 2017

Eranova

Post: #2
RE: Strange BUG in the STRING read
Because I don't know what the resulting sysmessage message should look like, I tried it like this:
PHP Code:
[DEFNAME achievement_def]
achievement_1_1_palier20    "500"

[FUNCTION test]
src.clearctags
src
.ctag0.achievement_1_1_palier 20
src
.sysmessage <eval <src.def.achievement_1_1_palier20>><eval <Src.ctag0.achievement_1_1_palier>> 

I typed DEFNAME in quotation marks and missed 20 in def.achievement_1_1_palier. I also added a src to the DEF link: def.achievement_1_1_palier

The result is: 50020

Should it be like this?


*


Edit last: Hi, I'm testing it, and I understand what you want to do. Oddly, it doesn't want to retrieve a number from DEFNAME. It always throws zero. Text displays correctly, numbers not yet. I count now in other scripts and I look for who invented it.
(This post was last modified: 11-20-2019 11:04 PM by golfin.)
11-20-2019 01:52 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Jhobean
Journeyman
*

Posts: 98
Likes Given: 11
Likes Received: 9 in 3 posts
Joined: Jun 2019
Reputation: 2



Post: #3
RE: Strange BUG in the STRING read
Thx for the try but it's not what i'm looking to do.

maybe look at this code it's more evident that the <2> can not be place in a <def.>

Code:
[DEFNAME achievement_def]
achievement_1_1_palier2    500

[FUNCTION test]
src.sysmessage <eval <src.def.achievement_1_1_palier<2>>>
11-20-2019 10:47 PM
Find all posts by this user Like Post Quote this message in a reply
Jhobean
Journeyman
*

Posts: 98
Likes Given: 11
Likes Received: 9 in 3 posts
Joined: Jun 2019
Reputation: 2



Post: #4
RE: [SOLVED] Strange BUG in the STRING read
THX, the answer is we must use an eval becaus the systeme return a value in hex with a 0 in front.

THX!

Why on X it,s work? I don't know HAHAHA
11-20-2019 11:50 PM
Find all posts by this user Like Post Quote this message in a reply
golfin
Banned

Posts: 213
Likes Given: 2
Likes Received: 32 in 28 posts
Joined: Nov 2017

Eranova

Post: #5
RE: [SOLVED] Strange BUG in the STRING read
PHP Code:
[DEFNAME achievement_def]
achievement_1_1_palier_20    "500"

[FUNCTION test]
src.clearctags
src
.ctag0.achievement_1_1_palier 20
sysmessage  
<eval <src.def.achievement_1_1_palier<eval <Src.ctag0.achievement_1_1_palier>>>> 

Jhobean already solved it, we were writing on the discord. But Coruja, isn't that weird? Why Eval twice? Due to the nature of the numerical number, I would not give the Eval function. Which gave zero. I do not get it.
(This post was last modified: 11-20-2019 11:53 PM by golfin.)
11-20-2019 11:52 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #6
RE: [SOLVED] Strange BUG in the STRING read
You're not really using double eval on the same value, but using eval on 2 different values

Sphere return TAG/CTAG/VAR/LOCAL/ARGS/etc values in hex by default, so if you set SRC.CTAG0.achievement_1_1_palier=20, <SRC.CTAG0.achievement_1_1_palier> will return 014 (which is 20 in hex)

And this will turn <DEF0.achievement_1_1_palier<SRC.CTAG0.achievement_1_1_palier>> into <DEF0.achievement_1_1_palier014> (which will be 0 because this DEF doesn't exist) and not <DEF0.achievement_1_1_palier20> (which is 500). So to make it work you must read the tag using eval to turn <DEF0.achievement_1_1_palier014> into <DEF0.achievement_1_1_palier20>

Probably experimental build return 500 even without the eval because it automatically eval values by default. Its easy to make sphere return values in dec instead hex but maybe its better leave it returning hex to preserve script compatibility because sphere always had returned hex values since decades ago. But anyway deal with dec values is much more readable than hex, so I will take a better look to check if this can be changed without cause any drawbacks
11-22-2019 02:59 AM
Find all posts by this user Like Post Quote this message in a reply
[+] 2 users Like Coruja's post
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)