MID$ and CHR$ problem

Previous topic - Next topic

MrTAToad

With the following code :

Code (glbasic) Select
DEBUG "X1\n"
thisText$=MID$(text$,0,xLoop%)
DEBUG "This text 0 : "+MID$(text$,0,xLoop%)+"\n"


I find that the first DEBUG statement is displayed, but the second isn't - the program just exits.

The cause seems to be :

Code (glbasic) Select
cItem.name$="Player "+CHR$(49)

for some reason.  CHR$ needs to be used due to various calculations that should be done.  Get rid of the CHR$ part and the first code section works fine.

The two bits of code are in separate files, by the way.

Doing :

Code (glbasic) Select

temp$=CHR$((49+MAX_PLAYERS%)-cItem.index%)
cItem.name$="Player "+temp$


is also fine (although inefficient).



Kitty Hello

uhm. I don't quite understand. Can you make a fully working example to show the bug?

MrTAToad

#2
Unfortunately it works fine in a small example, so I'm probably having to send my project... At the moment, I'm getting rid of the need for media, and stuff.

And its working properly too... :whistle:

Seems to be another cause - so I'm having to look for that now :)

It seems to be working properly now - so I think this one can be ignored...