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-nmm7 (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-nmm7 (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-nmm7 (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
Looking help with string text
Author Message
Breaker
Apprentice
*

Posts: 20
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Mar 2012
Reputation: 2



Post: #1
Question Looking help with string text
Try save numbers as text in local var? my checks:
PHP Code:
[FUNCTION CheckVAR]
LOCAL.TEST="100"
SRC.SYSMESSAGE Text: <LOCAL.TEST>
LOCAL.TEST=100
SRC
.SYSMESSAGE Number: <LOCAL.TEST

Output:
Text: 064
Number: 064

How can I save a variable number as text?

Sphere Version 0.56b-Nightly [WIN32] at Mar 30 2013
(This post was last modified: 03-30-2013 04:57 PM by Breaker.)
03-30-2013 04:56 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Shaklaban
Master
**

Posts: 378
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Mar 2012
Reputation: 8

DOT

Post: #2
RE: Looking help with string text
i think this is the only option for now:

[function vartest]
local.test=s100
sysmessage <strsub 1 <eval strlen <local.test>> <local.test>>
03-31-2013 12:17 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Ben
Sphere Developer
*****

Posts: 612
Likes Given: 2
Likes Received: 123 in 70 posts
Joined: Mar 2010
Reputation: 18

SphereCommunity

Post: #3
RE: Looking help with string text
It's actually all stored as a string. This issue comes when it outputs the information.
If it sees a number, it transform the string as a number.
Shak's sollution is the best one in this case.

AxisII's current version: 2.0.4j
AxisII SourceCode on Github
AxisII up to date changelog
03-31-2013 01:12 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Breaker
Apprentice
*

Posts: 20
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Mar 2012
Reputation: 2



Post: #4
RE: Looking help with string text
1. This will be fixed the problem? or it will be necessary each time an additional server load, though the quotes are worked on 55R, but is no longer. And solution of shaklaban is not right exit from this issue.
2. sphere have function <CHR > - what converts ANSII number into char, example <CHR 64> - conver to: "A", to really include in sphere <ORD A> for convert backward,
and maybe really include analog functions that can converts string to integer and backwards....

PS: it's all because of my function:
PHP Code:
[FUNCTION GENERATE_CODE// ARGN = Letters count of CODE
IF (<ARGN> > 1) && (<ARGN> < 64)
   FOR 
I 1 <ARGN>
      
LOCAL.CODE="<QVAL !StrMatch(0,<LOCAL.CODE>)?<LOCAL.CODE>><CHR <QVAL (RAND(5)==0)?<EVAL (RAND(10)+48)>:<EVAL (RAND(26)+65)>>>"
   
ENDFOR
   RETURN 
"<LOCAL.CODE>"
ENDIF
RETURN 


CHR - i find this into spheresvr.exe, yet she was no where, not what is not said =)

it's all because of my function:
PHP Code:
[FUNCTION GENERATE_CODE// ARGN = Letters count of CODE
IF (<ARGN> > 1) && (<ARGN> < 64)
   FOR 
I 1 <ARGN>
      
LOCAL.CODE="<QVAL !StrMatch(0,<LOCAL.CODE>)?<LOCAL.CODE>><CHR <QVAL (RAND(5)==0)?<EVAL (RAND(10)+48)>:<EVAL (RAND(26)+65)>>>"
   
ENDFOR
   RETURN 
"<LOCAL.CODE>"
ENDIF
RETURN 


i make that on this time:
PHP Code:
[FUNCTION INT]
IF (<
IsNUM <ARGS>>)  // or maybe IF STRREGEX(^[0-9]+$,<ARGS>)
   
RETURN <ARGN>
ENDIF
RETURN 


and use that
LOCAL.TEST = 2147483647
SRC.SYSMESSAGE Default: <LOCAL.TEST>
SRC.SYSMESSAGE Convert: <QVAL (<INT <LOCAL.TEST>>) ? <INT <LOCAL.TEST>> : Cannot convert string to integer >
what easy for sphere my method or method of "Shaklaban" ?

Sorry for my bad english =(
(This post was last modified: 03-31-2013 05:08 AM by Breaker.)
03-31-2013 03:11 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Ben
Sphere Developer
*****

Posts: 612
Likes Given: 2
Likes Received: 123 in 70 posts
Joined: Mar 2010
Reputation: 18

SphereCommunity

Post: #5
RE: Looking help with string text
You should look a little more...
http://wiki.sphere.torfo.org/index.php/C...:Variables
In this page you can find the CHR function, and also the ASC function that does the exact opposite.

AxisII's current version: 2.0.4j
AxisII SourceCode on Github
AxisII up to date changelog
03-31-2013 11:08 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Ben
Sphere Developer
*****

Posts: 612
Likes Given: 2
Likes Received: 123 in 70 posts
Joined: Mar 2010
Reputation: 18

SphereCommunity

Post: #6
RE: Looking help with string text
Ok as for LOCAL.TEST="100" not working to keep the string, I've done some tests and if a VAR is set from console this way, it keeps the quotes and everything works fine, but once it runs inside a script, it loses the quotes for some reason and stores the value as a hex num right away. I'm still trying to track down the location where this happens to see if it can be fixed without screwing something else Smile

AxisII's current version: 2.0.4j
AxisII SourceCode on Github
AxisII up to date changelog
03-31-2013 01:45 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Ben
Sphere Developer
*****

Posts: 612
Likes Given: 2
Likes Received: 123 in 70 posts
Joined: Mar 2010
Reputation: 18

SphereCommunity

Post: #7
RE: Looking help with string text
Ok fixed the problem, it will be available in the 1582 build.
So this means that
PHP Code:
[FUNCTION CheckVAR]
LOCAL.TEST="100"
SRC.SYSMESSAGE Text: <LOCAL.TEST>
LOCAL.TEST=100
SRC
.SYSMESSAGE Number: <LOCAL.TEST
will now work as intended and output:
Text: 100
Number: 064

AxisII's current version: 2.0.4j
AxisII SourceCode on Github
AxisII up to date changelog
03-31-2013 11:18 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #8
RE: Looking help with string text
good work Shock
04-01-2013 12:41 AM
Find all posts by this user Like Post Quote this message in a reply
admin phoenix
Master
**

Posts: 354
Likes Given: 1
Likes Received: 23 in 13 posts
Joined: Mar 2012
Reputation: 3



Post: #9
RE: Looking help with string text
thanks
alway used vars vor storing this one Smile
I thought I am too stupid because I didnĀ“t get it work with locals Smile
04-01-2013 07:07 AM
Find all posts by this user Like Post Quote this message in a reply
Breaker
Apprentice
*

Posts: 20
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Mar 2012
Reputation: 2



Post: #10
RE: Looking help with string text
THANKS YOU, I LOVE YOU Big Grin

PS:
BEN, i you can please look VAR and TAG variables.

i check on 1582 build
Code:
VAR.TEXT = "100"
SYSMESSAGE VAR STR: <VAR.TEXT>
VAR.TEXT = 100
SYSMESSAGE VAR NUM: <VAR.TEXT>
TAG.TEXT = "100"
SYSMESSAGE TAG STR: <TAG.TEXT>
TAG.TEXT = 100
SYSMESSAGE TAG NUM: <TAG.TEXT>
LOCAL.TEXT = "100"
SYSMESSAGE LOCAL STR: <LOCAL.TEXT>
LOCAL.TEXT = 100
SYSMESSAGE LOCAL NUM: <LOCAL.TEXT>
out:
Code:
VAR STR: 064
VAR NUM: 064
TAG STR: 064
TAG NUM: 064
LOCAL STR: 100
LOCAL NUM: 064

Thanks again....
(This post was last modified: 04-01-2013 02:06 PM by Breaker.)
04-01-2013 01:58 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


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