Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
2 registered members (Grant, AndrewAMD), 911 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
String Arrays? #366588
04/05/11 13:58
04/05/11 13:58
Joined: Dec 2010
Posts: 15
Munich, Germany
Kira Offline OP
Newbie
Kira  Offline OP
Newbie

Joined: Dec 2010
Posts: 15
Munich, Germany
I was trying to create an array of strings, but somehow it doesn't work, and what it says in the help is totally confusing and doesn't work either.

Basically what I want is this:
Code:
STRING* lvl_name [X] = {"Level1.wmb","Level2.wmb",...,"LevelX.wmb"};


...only that it doesn't throw me a syntax error when I try to run it.

Anyone got any ideas?

Last edited by Kira; 04/05/11 13:59.
Re: String Arrays? [Re: Kira] #366594
04/05/11 14:22
04/05/11 14:22
Joined: Mar 2009
Posts: 88
Walori Offline
Junior Member
Walori  Offline
Junior Member

Joined: Mar 2009
Posts: 88
The array you're trying to create has pointers for X amount. You're trying to create pointers as any normal string globally, but this is not the right way

When you're creating several strings to array you have to allocate (==create) each string before the pointer comes valid.The right to do what you're trying to achieve:
Code:
STRING* array[X];

function something()//Small example, repace strings with content you like
{
var i;
for(i=0;i<X;i++)
{
array[i] = str_create("Empty string!");
}
}



Re: String Arrays? [Re: Walori] #366595
04/05/11 14:28
04/05/11 14:28
Joined: Jan 2011
Posts: 122
GUILIN , CHINA
tzw Offline
Member
tzw  Offline
Member

Joined: Jan 2011
Posts: 122
GUILIN , CHINA
Use TEXT * can do this thing


Full of my eyes are class struggles.....
Re: String Arrays? [Re: tzw] #366690
04/06/11 12:24
04/06/11 12:24
Joined: Dec 2010
Posts: 15
Munich, Germany
Kira Offline OP
Newbie
Kira  Offline OP
Newbie

Joined: Dec 2010
Posts: 15
Munich, Germany
Well, the help-entry for the TEXT* thing only confused me more.
I think I'll stick with Walori's approach, it works just fine, thank you! =^,^=

Yeah, I feel so motivated now I'm gonna implement four more features!

Re: String Arrays? [Re: Kira] #366693
04/06/11 12:43
04/06/11 12:43
Joined: Jan 2011
Posts: 122
GUILIN , CHINA
tzw Offline
Member
tzw  Offline
Member

Joined: Jan 2011
Posts: 122
GUILIN , CHINA
good luck~


Full of my eyes are class struggles.....

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