3 registered members (NewbieZorro, TipmyPip, 1 invisible),
19,045
guests, and 8
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
How?: Variable into String and Variable from script2 to script_1
#326522
06/01/10 14:50
06/01/10 14:50
|
Joined: May 2010
Posts: 23 Germany
h34dl4g
OP
Newbie
|
OP
Newbie
Joined: May 2010
Posts: 23
Germany
|
Hi, I have 2 problems in my programm right now. The first one is, that I got a variable "health" in my script_2, but I cant get access to "health" when I'm in script_1. The programm thinks that health is equal to 0, even when I include script_2.
script_2.c:
var health = 100;
script_1.c:
#include "script_2.c"
PANEL* health_pan =
{
layer = 15;
digits (100, 200, "Life: %.f", arial_font, 1, health);
}
The second problem is, that I don't know how to save a variable into a string. I want to change the value of the string speed_str = "10" into the value of the variable "speed"
STRING* speed_str = "10";
speed += 10; <--- At this moment, I want that speed_str is equal "20";
TEXT* speed_txt =
{
pos_x = 100;
pos_y = 200;
string (speed_str);
}
I tried speed_str = "speed" <--- Of course that won't work...
Last edited by h34dl4g; 06/01/10 14:51.
1338, beyond leet.
|
|
|
Re: How?: Variable into String and Variable from script2 to script_1
[Re: Lukas]
#326529
06/01/10 15:26
06/01/10 15:26
|
Joined: May 2010
Posts: 23 Germany
h34dl4g
OP
Newbie
|
OP
Newbie
Joined: May 2010
Posts: 23
Germany
|
Thanks, I just changed your idea a bit, since I wanted to give the string a value. This was the code that I have used:
STRING* speed_str = "10";
var speed = 10;
speed = speed+10;
str_for_num(speed_str, speed)
I sill can't find any solution for my first problem, but I'm still trying. I will post again if it won't work.
Last edited by h34dl4g; 06/01/10 15:27.
1338, beyond leet.
|
|
|
Re: How?: Variable into String and Variable from script2 to script_1
[Re: Widi]
#326588
06/01/10 19:03
06/01/10 19:03
|
Joined: May 2010
Posts: 23 Germany
h34dl4g
OP
Newbie
|
OP
Newbie
Joined: May 2010
Posts: 23
Germany
|
Yes I have, but it still makes problems. I'm going to create a define script and connect them together. Lets hope it works then.
1338, beyond leet.
|
|
|
|