TEXT not working at all?

Posted By: Metal_Thrasher

TEXT not working at all? - 04/17/09 06:09

I take TEXT* straight from the manual implement it into my script. and it dosen't work? It tell me it doesn't know what "TEXT*" is. This frustrating...

Help please?
Posted By: delinkx

Re: TEXT not working at all? - 04/17/09 07:03

is it lite-c or c-script u using ?
Posted By: EvilSOB

Re: TEXT not working at all? - 04/17/09 07:17

If you are using c-script, drop the asterisk, its lite-c only.

If you are using lite-c, make sure SED has saved your source files as C and not WDL.
It is easy to not notice...
Posted By: delinkx

Re: TEXT not working at all? - 04/17/09 07:27

yeps. c-script calls objects directly but lite-c uses pointers.

from the manual:

Quote:

In C-Script, we had to differentiate between object definitions (PANEL mypanel = {... }) and object pointers (PANEL* mypanelpointer = mypanel;). In lite-C, objects are always pointers. So it's now PANEL* mypanel = { ... }.


Posted By: Metal_Thrasher

Re: TEXT not working at all? - 04/17/09 09:53

Thank a billion dudes.
You'd think my stupid ass would have figured that one out.
Thanks again...
although i have another stupid question for you at this point. How do I assign the value of a variable to a string. For instance displaying the amount of the player's health stored in a variable.
Posted By: delinkx

Re: TEXT not working at all? - 04/17/09 10:23

for c-script i guess should be like this:

Code:

STRING mystring = "     ";
var myvariable = 123;
str_for_num(mystring, myvariable); 
	

Posted By: EvilSOB

Re: TEXT not working at all? - 04/17/09 10:25

Beware the number and placement of brackets! Important!
str_cpy((panelname.pstring)[linenumber],""); //clear existing content.(even first time)
str_cat_num((panelname.pstring)[linenumber], "%.3f", thenumber); //display number to 3 decimal places.


NOTE: not sure if this is c-script friendly or not. I live lite-c and my WDL is shoddy smile
Posted By: ShoreVietam

Re: TEXT not working at all? - 04/17/09 19:19

Never saw something like this in C-Sript, there are no type conversions in C-Script since there is only one type.

To avaid str_for_num() printing out all 3 numbers after the comma pass the variable through the int() function.
© 2024 lite-C Forums