problems with ftos in csqc
Moderator: InsideQC Admins
5 posts
• Page 1 of 1
problems with ftos in csqc
I can not get a string in csqc to print in some csqc buttons i created.
i wanna to write the number of "s_tornillo" inside the button but doesn´t work.
I tested this code to redefine the string "s_tornillo" and works perfectly in the button
This is very stupid code, but i can say the button work. I just wanna to get the string to the number of the float "g_tornillo", but ftos doesn´t work inside my button. CSQC doesn´t write anything in my buttons. But when i define the strings it works. Any idea about it? Thanks
- Code: Select all
float g_tornillo;
string s_tornillo; // a string that write a number inside the button.
g_tornillo = getstatf(STAT_ITEM_TORNILLO );
s_tornillo = ftos(g_tornillo); // doesn´t work. i also tested s_tornillo = ftos(STAT_ITEM_TORNILLO ); with no positive results
if (g_tornillo >= 1)
{
CreateButton( s_tornillo,"impulse 19\n;back",men, buttonback, but_size, 1");
}
else
{
CreatePic( men, buttonback, but_size, 0.1);
}
men_x = men_x + but_size_x;
i wanna to write the number of "s_tornillo" inside the button but doesn´t work.
I tested this code to redefine the string "s_tornillo" and works perfectly in the button
- Code: Select all
if (g_tornillo == 1)
s_tornillo = "1";
else if (g_tornillo == 2)
s_tornillo = "2";
This is very stupid code, but i can say the button work. I just wanna to get the string to the number of the float "g_tornillo", but ftos doesn´t work inside my button. CSQC doesn´t write anything in my buttons. But when i define the strings it works. Any idea about it? Thanks
hi, I am nahuel, I love quake and qc.
-

Nahuel - Posts: 492
- Joined: Wed Jan 12, 2011 8:42 pm
- Location: mar del plata
Re: problems with ftos in csqc
ftos returns a temp string. temp strings are only valid for the duration of the qc invocation.
Specifically, this means that when you return from qc to the engine, all your tempstrings get wiped.
Try strzone and strunzone from the FRIK_FILE extension.
Specifically, this means that when you return from qc to the engine, all your tempstrings get wiped.
Try strzone and strunzone from the FRIK_FILE extension.
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
Re: problems with ftos in csqc
Spike wrote:ftos returns a temp string. temp strings are only valid for the duration of the qc invocation.
Specifically, this means that when you return from qc to the engine, all your tempstrings get wiped.
Try strzone and strunzone from the FRIK_FILE extension.
Thanks for the request Spike, i have another question: What is the use of tokenize?
hi, I am nahuel, I love quake and qc.
-

Nahuel - Posts: 492
- Joined: Wed Jan 12, 2011 8:42 pm
- Location: mar del plata
Re: problems with ftos in csqc
tokenize splits a string into its tokens.
hello world "and anyone else that will" listen
hello
world
and anyone else that will
listen
use argv(0 to 3) to retrieve those four strings after tokenizing. The builtin itself will return the number of tokens available (4).
hello world "and anyone else that will" listen
hello
world
and anyone else that will
listen
use argv(0 to 3) to retrieve those four strings after tokenizing. The builtin itself will return the number of tokens available (4).
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
Re: problems with ftos in csqc
Hello Nahuel,
Spike also explained/suggested me once, to use "tokenize" for another issue I had.
At that time I had the exact same question like you. We both speak too bad english to understand QC intuitively, Nahuel
The key words are made to be as understandable as possible without reading documentation,
except for some people from Argentinia and Germany, hehe
It is interesting to see with which difficulties we both have to stuggle sometimes...
Sorry for offtopic, I just wanted to tell you this.
Best wishes Nahuel,
Seven
Spike also explained/suggested me once, to use "tokenize" for another issue I had.
At that time I had the exact same question like you. We both speak too bad english to understand QC intuitively, Nahuel
The key words are made to be as understandable as possible without reading documentation,
except for some people from Argentinia and Germany, hehe
It is interesting to see with which difficulties we both have to stuggle sometimes...
Sorry for offtopic, I just wanted to tell you this.
Best wishes Nahuel,
Seven
- Seven
- Posts: 301
- Joined: Sat Oct 06, 2007 8:49 pm
- Location: Germany
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest