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
0 registered members (), 18,508 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
Page 1 of 2 1 2
STRING* Array #356530
02/02/11 17:14
02/02/11 17:14
Joined: Dec 2010
Posts: 63
C
Ceryni Offline OP
Junior Member
Ceryni  Offline OP
Junior Member
C

Joined: Dec 2010
Posts: 63
hi,

i have aproblem i wanted to create a chat.
therefor i created a STRING* chatmsgs[5]; .

now i do this
Code:
function receive_chat_msg(var sender, STRING* msg)
{
	STRING* save_string = "#100"; //stores the msg string, because it's only 1 frame available
	
	str_cpy(save_string,msg);
	
	str_cpy(chatmsgs[4],chatmsgs[3]);
	str_cpy(chatmsgs[3],chatmsgs[2]);
	str_cpy(chatmsgs[2],chatmsgs[1]);
	str_cpy(chatmsgs[1],chatmsgs[0]);
	str_cpy(chatmsgs[0],save_string);
}



whenever i write a new mesage a error occure that tehres a error in this funtion. annybody knows help?

Re: STRING* Array [Re: Ceryni] #356532
02/02/11 17:28
02/02/11 17:28
Joined: Jan 2011
Posts: 120
United States
Logan Offline
Member
Logan  Offline
Member

Joined: Jan 2011
Posts: 120
United States
You have to initialize STRING*s before using str_cpy, I think... I have had the engine yell at me similarly when I fail to do so.

So set them all to "" in your main function or a startup function.
Code:
int i;
for(i=0; i<5; i++)
     chatmsgs[i] = "";



Re: STRING* Array [Re: Ceryni] #356540
02/02/11 17:48
02/02/11 17:48
Joined: Dec 2010
Posts: 63
C
Ceryni Offline OP
Junior Member
Ceryni  Offline OP
Junior Member
C

Joined: Dec 2010
Posts: 63
hi,

i tryed this but than it shoutsdown when it should display the messages otherwise the are all (null).

thats the panel
Code:
PANEL* chat_panel=
{
	digits(0,0,"%s",*,1,chatmsgs[4]);	
	digits(0,50,"%s",*,1,chatmsgs[3]);	
	digits(0,100,"%s",*,1,chatmsgs[2]);	
	digits(0,150,"%s",*,1,chatmsgs[1]);	
	digits(0,200,"%s",*,1,chatmsgs[0]);	
}



Re: STRING* Array [Re: Ceryni] #356542
02/02/11 17:54
02/02/11 17:54
Joined: Jan 2011
Posts: 120
United States
Logan Offline
Member
Logan  Offline
Member

Joined: Jan 2011
Posts: 120
United States
Shoot. Alright. What are the exact error messages?

Re: STRING* Array [Re: Logan] #356544
02/02/11 18:09
02/02/11 18:09
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
int i;
for(i=0; i<5; i++)
chatmsgs[i] = str_create("");

chatmsgs[i] is only a pointer. First you have to create the string where the pointer points.

Re: STRING* Array [Re: Ceryni] #356547
02/02/11 18:17
02/02/11 18:17
Joined: Dec 2010
Posts: 63
C
Ceryni Offline OP
Junior Member
Ceryni  Offline OP
Junior Member
C

Joined: Dec 2010
Posts: 63
theres no error message by the engine it is the windows send or dont send error.

i use anet so when the server is started and the client connects
so that the panel is displayed at the client the message apears when i comment the show flag so nothing is displayed everything else works fine

same with str_create and str_create dont become red like other functions

Last edited by Ceryni; 02/02/11 18:55.
Re: STRING* Array [Re: Ceryni] #356588
02/02/11 20:34
02/02/11 20:34
Joined: Dec 2010
Posts: 63
C
Ceryni Offline OP
Junior Member
Ceryni  Offline OP
Junior Member
C

Joined: Dec 2010
Posts: 63
str_create dont become red like all other function do i have to include another file maybe?

Last edited by Ceryni; 02/03/11 06:44.
Re: STRING* Array [Re: Ceryni] #356663
02/03/11 10:07
02/03/11 10:07
Joined: Dec 2010
Posts: 63
C
Ceryni Offline OP
Junior Member
Ceryni  Offline OP
Junior Member
C

Joined: Dec 2010
Posts: 63
No idea?

Re: STRING* Array [Re: Ceryni] #356665
02/03/11 10:50
02/03/11 10:50
Joined: Feb 2010
Posts: 320
TANA/Madagascar
3dgs_snake Offline
Senior Member
3dgs_snake  Offline
Senior Member

Joined: Feb 2010
Posts: 320
TANA/Madagascar
Hi,

In my version (A7 7.8.6) str_create is red like many 3dgs engine functions. Generally, you need to include acknex.h, but if it compiles fine, then there should be no problem.

best regards.

Re: STRING* Array [Re: Ceryni] #356676
02/03/11 11:53
02/03/11 11:53
Joined: Dec 2010
Posts: 63
C
Ceryni Offline OP
Junior Member
Ceryni  Offline OP
Junior Member
C

Joined: Dec 2010
Posts: 63
thers always the windows error when it should display the panel so i dont know if it works fine

Page 1 of 2 1 2

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