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
5 registered members (Dico, AndrewAMD, TipmyPip, NewbieZorro, Grant), 15,253 guests, and 5 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
Whats wrong here? #281474
07/27/09 13:36
07/27/09 13:36
Joined: May 2009
Posts: 445
Peine, Germany
Razoron Offline OP
Senior Member
Razoron  Offline OP
Senior Member

Joined: May 2009
Posts: 445
Peine, Germany
Hey guys,
I have a simple problem with an array of strings. I want to initialize all with "#10". So i made a loop:

STRING*string[1100];

function main()
{
var i=0;
while (i<1050)
{
string[i]="#10";
i++;
wait(1);
}
}

I've got an error: Invalid arguments in main.

What i made wrong?

Regards Raz

Re: Whats wrong here? [Re: Razoron] #281489
07/27/09 14:03
07/27/09 14:03
Joined: Apr 2006
Posts: 737
Ottawa, Canada
O
Ottawa Offline
User
Ottawa  Offline
User
O

Joined: Apr 2006
Posts: 737
Ottawa, Canada
Hi!

I think it as something to do with :

Quote:

If the text contains more than one string, individual strings can be accessed through a (text.pstring)[] index suffix, just like variable arrays.



Hope this helps!
Ottawa laugh

Ver 7.86.2 Pro and Lite-C
Re: Whats wrong here? [Re: Ottawa] #281490
07/27/09 14:10
07/27/09 14:10
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
@ Ottawa, that only applies to TEXT* objects, he's not working with them.

try this...(untested!)...

Code:
STRING* mystrings[1100];

for(int i=0; i<1100; i++)
{
str_cpy(mystrings[i],"#10");
}



Re: Whats wrong here? [Re: DJBMASTER] #281497
07/27/09 14:30
07/27/09 14:30
Joined: Jun 2008
Posts: 31
Moscow, Russia
L
LunaticX Offline
Newbie
LunaticX  Offline
Newbie
L

Joined: Jun 2008
Posts: 31
Moscow, Russia
STRING* string[1100];//array of empty pointers

for(i=0; i<1100; i++)
{
mystrings[i] = str_create("#10");//create strings
}

Re: Whats wrong here? [Re: LunaticX] #281521
07/27/09 15:55
07/27/09 15:55
Joined: May 2009
Posts: 445
Peine, Germany
Razoron Offline OP
Senior Member
Razoron  Offline OP
Senior Member

Joined: May 2009
Posts: 445
Peine, Germany
Thanks for fast answering laugh. The one from LunaticX works, because we need to create a string in runtime. Thanks.


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