Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
7 registered members (3run, miwok, AndrewAMD, Quad, TipmyPip, fairtrader, 1 invisible), 637 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Question about strings #118857
03/22/07 12:02
03/22/07 12:02
Joined: Mar 2006
Posts: 724
the Netherlands
Frits Offline OP
User
Frits  Offline OP
User

Joined: Mar 2006
Posts: 724
the Netherlands
I create an entity with
Code:

string sign;
string str00;
string str01="m_number_0";
string str02;
string str03=".bmp";

funtion show_sign_event()
{
..............
str_for_asc(str02,sprite_number+48); //change 1 to 9 into a string "1" to "9"
str_cat(str00,str01); //append str00 with str01
str_cat(str00,str02); //append str00 with str02
str_cat(str00,str03); //append str00 with str03
..............
..............
str_cpy(sign,str00); //copy str00 into sign
str_cpy(str00," "); //empty str00 for nex filename

sign_number=ent_create(sign,sgn05.x,modify_sprite_event); //load the sprite
}


the first file loads perfectly, but with the second file I get an error;
Mailfunction W1301
<M_NUMBER_02.BMP>: can't open file

Now this is strange because all these files are in the same directory (images) and in the script where to find these files; 'path "..\\images";'.
Has anyone an idea how this is possible?


I like to keep scripting simple, life is hard enough as it is.
Regards,
Frits
Re: Question about strings [Re: Frits] #118858
03/22/07 13:09
03/22/07 13:09

A
Anonymous
Unregistered
Anonymous
Unregistered
A



replace str_cat(str00,str01); with str_cpy(str00,str01); and remove line str_cpy(str00," ");.

With the second call your name is like this: " M_NUMBER_02.BMP" (watch the space in the first pos!)

mercuryus


PS: why not use str_for_num(str02,sprite_number); instead of str_for_asc(str02,sprite_number+48);?

Re: Question about strings [Re: Frits] #118859
03/22/07 13:15
03/22/07 13:15
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
Deleted...

Last edited by xXxGuitar511; 03/22/07 13:17.

xXxGuitar511
- Programmer
Re: Question about strings [Re: xXxGuitar511] #118860
03/22/07 13:16
03/22/07 13:16
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
Ha, Mercuryus got to it before me, and caught the error as well...

Thanks... lol.


xXxGuitar511
- Programmer
Re: Question about strings [Re: xXxGuitar511] #118861
03/22/07 15:01
03/22/07 15:01
Joined: Mar 2006
Posts: 724
the Netherlands
Frits Offline OP
User
Frits  Offline OP
User

Joined: Mar 2006
Posts: 724
the Netherlands
Thanks Mercuryus, I did not notice the space in front of the name and I did not know that I could use 'str_for_num', thanks for that also.

xXxGuitar511, sorry you were just too late


I like to keep scripting simple, life is hard enough as it is.
Regards,
Frits

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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