Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (vicknick, AndrewAMD), 1,292 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 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 | 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