Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,295 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
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 Offline OP
Newbie
h34dl4g  Offline 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.
Code:
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"
Code:
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: h34dl4g] #326526
06/01/10 15:02
06/01/10 15:02
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
First problem:
Make sure that you don't set health to 0 anywhere. You can also try if the problem ist still there if you define your variable in your main script. If it does, your problem does not related to your second script.


Second problem:
You can use str_for_num.

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 Offline OP
Newbie
h34dl4g  Offline 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:

Code:
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: h34dl4g] #326561
06/01/10 16:52
06/01/10 16:52
Joined: May 2009
Posts: 445
Peine, Germany
Razoron Offline
Senior Member
Razoron  Offline
Senior Member

Joined: May 2009
Posts: 445
Peine, Germany
I hope you did that in a function.

Re: How?: Variable into String and Variable from script2 to script_1 [Re: Razoron] #326570
06/01/10 17:36
06/01/10 17:36
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
You have a main function in your script 1?

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 Offline OP
Newbie
h34dl4g  Offline 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.

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

Gamestudio download | chip programmers | 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