Gamestudio Links
Zorro Links
Newest Posts
Camera always moves upwards?
by clonman. 11/13/25 14:04
brokerCommand PLOT_HLINE parameters
by M_D. 11/13/25 10:42
ZorroGPT
by TipmyPip. 11/10/25 11:04
Training with the R bridge does not work
by frutza. 11/05/25 00:46
Zorro 2.70
by opm. 10/24/25 03:44
Alpaca Plugin v1.4.0
by TipmyPip. 10/20/25 18:04
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 31,184 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sheliepaley, Blueguy, blobplayintennis, someone2, NotEBspark
19177 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
str_cpy problem #331364
07/03/10 19:47
07/03/10 19:47
Joined: Apr 2009
Posts: 141
dakilla Offline OP
Member
dakilla  Offline OP
Member

Joined: Apr 2009
Posts: 141
hi,
i have been writing a code for generating a player name using strings for prefixes/suffixes, but the code i have written shows up an error "invalid arguements".

Here is the code:

STRING* prefix1 [20];
STRING* suffix1 [20];
STRING* char_name;

function set_presuf()
{

str_cpy(char_name,"Press Space to Name");

str_cpy(prefix1[1], "Odd");
str_cpy(prefix1[2], "Sar");
str_cpy(prefix1[3], "Stag");
str_cpy(prefix1[4], "Red");
str_cpy(prefix1[5], "Cob");
str_cpy(prefix1[6], "Sol");
str_cpy(prefix1[7], "Tom");
str_cpy(prefix1[8], "Star");
str_cpy(prefix1[9], "Taz");
str_cpy(prefix1[10], "Veer");
str_cpy(prefix1[11], "Pag");
str_cpy(prefix1[12], "Moth");
str_cpy(prefix1[13], "Yelp");
str_cpy(prefix1[14], "Spas");
str_cpy(prefix1[15], "Jun");
str_cpy(prefix1[16], "Spindle");
str_cpy(prefix1[17], "Deak");
str_cpy(prefix1[18], "Pok");
str_cpy(prefix1[19], "Yun");
str_cpy(prefix1[20], "Stab");

str_cpy(suffix1[1], "head");
str_cpy(suffix1[2], "uld");
str_cpy(suffix1[3], "ond");
str_cpy(suffix1[4], "elder");
str_cpy(suffix1[5], "rig");
str_cpy(suffix1[6], "werty");
str_cpy(suffix1[7], "erty");
str_cpy(suffix1[8], "rag");
str_cpy(suffix1[9], "wandil");
str_cpy(suffix1[10], "cup");
str_cpy(suffix1[11], "fire");
str_cpy(suffix1[12], "riddler");
str_cpy(suffix1[13], "dernal");
str_cpy(suffix1[14], "hoble");
str_cpy(suffix1[15], "ernal");
str_cpy(suffix1[16], "ugar");
str_cpy(suffix1[17], "addle");
str_cpy(suffix1[18], "rond");
str_cpy(suffix1[19], "al");
str_cpy(suffix1[20], "indel");

}


thanks in advance, dakilla.


One day there will be an unfixable bug,
That day is not today.
Re: str_cpy problem [Re: dakilla] #331367
07/03/10 20:00
07/03/10 20:00
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
An array begins with 0 and ends with n-1 while n is the size of the array.

This is because [n] shifts the pointer at n adresses to the next element, but your pointer points also to an valid element.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: str_cpy problem [Re: WretchedSid] #331368
07/03/10 20:02
07/03/10 20:02
Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
also you should first

prefix1[1] = str_create("Odd");
instead of
str_cpy(prefix1[1], "Odd");


3333333333
Re: str_cpy problem [Re: Quad] #331373
07/03/10 20:42
07/03/10 20:42
Joined: Apr 2009
Posts: 141
dakilla Offline OP
Member
dakilla  Offline OP
Member

Joined: Apr 2009
Posts: 141
ahh, thanks, its now invalid argument free


One day there will be an unfixable bug,
That day is not today.

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