Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (AndrewAMD, TipmyPip, OptimusPrime), 15,229 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Problem with making numeric var to text #224943
09/02/08 04:53
09/02/08 04:53
Joined: Aug 2006
Posts: 18
Australia
M
markman Offline OP
Newbie
markman  Offline OP
Newbie
M

Joined: Aug 2006
Posts: 18
Australia
This is what I am trying to do


I have a var called fish_counter. Tis is defined and hold a numeric value using text, Not panels
eg: fishcounter = 0;

display that number 0 on screen using text
also how i do physically change the size of text?
make it bigger and smaller. nayone know the command for that.


Below is code im using. it keeps crashing on fish_counter line

TEXT message_text =
{
layer = 3;
pos_x =525;
pos_y = 450;
size_y = 400;
offset_y = 0;

string ("YOU HAVE CAUGHT ","","Fish");
flags = CENTER_X | TRANSPARENT | VISIBLE;
}



function stoptimer()//function to display you caught **** no of fish

//if (count_Dmin == 1) //after 10 mins wiil put back later after testing complete
if (count_min == 1)
{total_fish.visible = on;
message_text.visible = off;//turns my test message string off
//freeze_mode = 2;


var score =(3);
var message = (30);
str_for_num (score, fish_counter);
str_cat(message,"You have ");
str_cat(message,score);
str_cat(message," fish!");


}
Many thanks


Last edited by markman; 09/02/08 04:56.
Re: Problem with making numeric var to text [Re: markman] #224965
09/02/08 09:02
09/02/08 09:02
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
if you want it to appear on 3 seperate lines, just use
Code:
str_for_num (message_text.string[1], fish_counter);
to update the second string with the fish_counter

if you want it all on one line use,
string message = "#30"; //set a string to hold 30 characters
Code:
str_cpy(message, "You have ");
str_cat_num(message, "%.0f", fish_counter);
str_cat(message, " fish!");


when converting a data type to a string, you need to place it into a string
for the font size, look at text.font in the manual

Hope this helps

Re: Problem with making numeric var to text (resolved) [Re: MrGuest] #224994
09/02/08 13:45
09/02/08 13:45
Joined: Aug 2006
Posts: 18
Australia
M
markman Offline OP
Newbie
markman  Offline OP
Newbie
M

Joined: Aug 2006
Posts: 18
Australia
TEXT message_text =
{
layer = 3;
pos_x =525;
pos_y = 450;
size_y = 400;
offset_y = 0;

string ("YOU HAVE CAUGHT ","","Fish");
flags = CENTER_X | TRANSPARENT | VISIBLE;
}
ok I know this will show up the text on the screen like a panel does and you can control it with message_text.visible = on/off;

however I still can figure out how to get fish counter into displaying number into string...

I still cant get it to work in my function :P
its just not clear enough for me.
string are an entirley new concept for me, but panels no probs



Thanks for the help guys,, all working now probelm resolved!!!
THANKYOU MR GUEST smile


Last edited by markman; 09/02/08 14:03.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1