Looking help with string text - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: Script Help (/Forum-Script-Help) +--- Thread: Looking help with string text (/Thread-Looking-help-with-string-text) Pages: 1 2 |
Looking help with string text - Breaker - 03-30-2013 04:56 PM Try save numbers as text in local var? my checks: PHP Code: [FUNCTION CheckVAR] Output: Text: 064 Number: 064 How can I save a variable number as text? Sphere Version 0.56b-Nightly [WIN32] at Mar 30 2013 RE: Looking help with string text - Shaklaban - 03-31-2013 12:17 AM i think this is the only option for now: [function vartest] local.test=s100 sysmessage <strsub 1 <eval strlen <local.test>> <local.test>> RE: Looking help with string text - Ben - 03-31-2013 01:12 AM 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. RE: Looking help with string text - Breaker - 03-31-2013 03:11 AM 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 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 i make that on this time: PHP Code: [FUNCTION INT] 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 =( RE: Looking help with string text - Ben - 03-31-2013 11:08 AM You should look a little more... http://wiki.sphere.torfo.org/index.php/Category:Variables In this page you can find the CHR function, and also the ASC function that does the exact opposite. RE: Looking help with string text - Ben - 03-31-2013 01:45 PM 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 RE: Looking help with string text - Ben - 03-31-2013 11:18 PM Ok fixed the problem, it will be available in the 1582 build. So this means that PHP Code: [FUNCTION CheckVAR] Text: 100 Number: 064 RE: Looking help with string text - darksun84 - 04-01-2013 12:41 AM good work RE: Looking help with string text - admin phoenix - 04-01-2013 07:07 AM thanks alway used vars vor storing this one I thought I am too stupid because I didnĀ“t get it work with locals RE: Looking help with string text - Breaker - 04-01-2013 01:58 PM THANKS YOU, I LOVE YOU PS: BEN, i you can please look VAR and TAG variables. i check on 1582 build Code: VAR.TEXT = "100" Code: VAR STR: 064 Thanks again.... |