Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (7th_zorro), 927 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
send_string problem. #328065
06/10/10 12:37
06/10/10 12:37
Joined: Jan 2010
Posts: 4
Albania
S
Sieg Offline OP
Guest
Sieg  Offline OP
Guest
S

Joined: Jan 2010
Posts: 4
Albania
Hi everyone,I'm pretty new here and I'm having a problem with the send_string command.I'm trying to send a string input from the client to the server so it can store it in a file:

CIENT SIDE:
STRING* temp1_str = "#8";
STRING* temp2_str = "#8";

function acc_sett_send() //activated when button pressed
{

if ((str_cmpni(temp1_str, " ") == 0) && (str_cmpni (temp2_str, " ") == 0))
{
send_string(temp1_str);
send_string(temp2_str);
}
else
{
error("You must fill both slots"); //temporary msg
}

SERVER SIDE:

STRING* temp1_str = "default";
STRING* temp2_str = "default";

function on_server_event(void* str,var id)
{
while(event_type == EVENT_STRING)
{
var acchandle = file_open_write("somefolder//new.txt");
file_str_write(acchandle,temp1_str);// writes the files to a new folder
file_str_write(acchandle,temp2_str);
file_close (acchandle);
wait(1);
}
}

I'd appreciate some help and some clarifiement.
edit:the string is sent but it's not updated on the server side.Is there something i haven't already pinpointed or what?

Sieg.


Last edited by Sieg; 06/10/10 13:16.
Re: send_string problem. [Re: Sieg] #328074
06/10/10 13:08
06/10/10 13:08
Joined: Dec 2005
Posts: 116
T
tD_Datura_v Offline
Member
tD_Datura_v  Offline
Member
T

Joined: Dec 2005
Posts: 116
potential main error point = while(condition) { wait(1); } loop in event function, on_server_event.
Some guesswork:
Code:
function on_server_event(void* str,var id) {
	if (event_type == EVENT_STRING)  {
		// temp2_str indicates a terminating sequence?
		if (str == temp2_str	
		&& (str_cmpni(temp1_str, "default") == 0)) {	
			var acchandle = file_open_write("new.txt");
			file_str_write(acchandle,temp1_str);
			file_str_write(acchandle,temp2_str);
			file_close (acchandle);
		}
	}
}






Re: send_string problem. [Re: tD_Datura_v] #328078
06/10/10 13:33
06/10/10 13:33
Joined: Jan 2010
Posts: 4
Albania
S
Sieg Offline OP
Guest
Sieg  Offline OP
Guest
S

Joined: Jan 2010
Posts: 4
Albania
Originally Posted By: tD_Datura_v
potential main error point = while(condition) { wait(1); } loop in event function, on_server_event.
Some guesswork:
Code:
function on_server_event(void* str,var id) {
	if (event_type == EVENT_STRING)  {
		// temp2_str indicates a terminating sequence?
		if (str == temp2_str	
		&& (str_cmpni(temp1_str, "default") == 0)) {	
			var acchandle = file_open_write("new.txt");
			file_str_write(acchandle,temp1_str);
			file_str_write(acchandle,temp2_str);
			file_close (acchandle);
		}
	}
}



Still nothing,now the file isn't even created because the string isn't updated.So your if condition returns to false.I guess that's not the problem ...

Sieg.

Last edited by Sieg; 06/10/10 13:51.
Re: send_string problem. [Re: Sieg] #328080
06/10/10 13:40
06/10/10 13:40
Joined: Dec 2005
Posts: 116
T
tD_Datura_v Offline
Member
tD_Datura_v  Offline
Member
T

Joined: Dec 2005
Posts: 116
Are there supposed to be differences between the client and server scripts?
temp1_str and temp2_str are defined differently in client and server.






Re: send_string problem. [Re: tD_Datura_v] #328084
06/10/10 13:51
06/10/10 13:51
Joined: Jan 2010
Posts: 4
Albania
S
Sieg Offline OP
Guest
Sieg  Offline OP
Guest
S

Joined: Jan 2010
Posts: 4
Albania
I've thought of that too,when i tried to send the strings the first time i defined them the same way.Anyway I think that the strings must only exist at both sides and not to be defined the same way too since the result was the same.Is this really so hard and so impossible to happen?Seems like no one can figure it out.

edit:I'm using 7.8.0 if comes handy to know.

Sieg.

Last edited by Sieg; 06/10/10 14:18.
Re: send_string problem. [Re: tD_Datura_v] #328111
06/10/10 15:55
06/10/10 15:55
Joined: Jan 2010
Posts: 4
Albania
S
Sieg Offline OP
Guest
Sieg  Offline OP
Guest
S

Joined: Jan 2010
Posts: 4
Albania
I'm sorry about the double post but on this depends my whole project since the whole multiplayer system works by sending strings vars and datas.No one has a clue on how to make the string change?if it's not a code problem someone notice me please.

Edit:I managed to do it myself thnx for the 'great help'.
Sieg.

Last edited by Sieg; 06/12/10 00:06.

Moderated by  HeelX, Spirit 

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