PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Variables Error in Version 0.9

directdance · 02 Jan 2006, 09:37 UTC
Hi,

I wrote a program with Version 0.8a. Today, I wanted to perform a small bug fix but after compiling, my program is not working anymore.

What changed is something in the variable structure. The routine listed here is for testing a date structure. If the field day is only from 1 to 9, the field has to be converted to e.g. 01 or 02 for today. This worked in v0.8a:

(... get system date before, HH_TAG means actual day ...)

if(int(HH_TAG$ <= 9))
HH_ZWI$ = ("0" + HH_TAG$);
HH_TAG$ = HH_ZWI$;
ShowMessage(HH_ZWI$);
end;

For today (2nd of Jan, 06) the result of HH_ZWI$ is "2". In V0.8a it was "02". I changed the "0" to "3" for testing. The result is "5". If I changed the "0" to "A0", the result was "A02". I don“t want to calculate the zero plus 2 = 2. For this I used the "". For calculating I would leave the "" away. E.g. HH_ZWI$ = (0 + HH_TAG$);
PPL should recognize again, that using "0" instead of only 0 should be a character addition.

A second one wich is not working in V0.9 anymore is:

HH_TAG$ = "02"; // Actual day
HH_MONAT$ = "01"; // Actual Month
HH_JAHR$ = "06"; // Actual Year

HH_HEUTE$ = HH_TAG$ + "." + HH_MONAT$ + "." + HH_JAHR$;

// result in V0.8a was "02.01.06"
in V0.9 the result is 9

Is there a possibility to download the 0.8a again?

Thanks a lot !
DirectDance
directdance · 02 Jan 2006, 10:47 UTC — found the 0.8 from 09.09.05
... and installed it. Now, my program is working fine again ...

Cheers,
DirectDance
Kornalius,

I ran across the same problem. It seems that if all chars in a string are numeric ("0"-"9" or "." are the ones that I have verified. I didn't check "+" or "-") then the string gets converted to numeric if using the "+" operator. Even your simple example on the STR page in the CHM file now returns numeric...

Code:
x$ = 10;
y$ = 20;
ShowMessage(str(x$)+str(y$));

gives 30 instead of "1020"

Hope that you are having a great vacation!

DirectDance,

IMHO, version 0.9 is much better than version 0.8a. I would suggest that you use "concat" until this is fixed. So instead of...

Code:
HH_HEUTE$ = HH_TAG$ + "." + HH_MONAT$ + "." + HH_JAHR$;


you would code it this way...

Code:
HH_HEUTE$ = CONCAT(HH_TAG$, ".", HH_MONAT$, ".", HH_JAHR$);


I have had to make these changes to my code to work around the problem.

Good Luck,

bmanske
directdance · 04 Jan 2006, 09:18 UTC
Hi bmanske,

thanks for your hint. I did not know the CONCAT function before.

I will give it a try.


Thanks,
DirectDance
Even better, use the % operator it concatenate strings together.

Code:
"0" + 2; will result in value 2.

a$ = "21";
"0" + a$; will result in value 21.
"@" + a$; will result in string "@21".

a$ = "21";
"0" % a$; will result in string "021".
2 % a$; will result in string "221".


The + operator will convert the values to numeric if it can and add them together, if it cannot it will simply convert both values to string and concatenate them.
Now that you mention it... I remember wondering at the time what the difference was between '+' and '%' and I didn't look into it.

So I think that all is working properly. I just have a few spots where I need to exchange the 2 operators.

When you get a chance, please update the CHM for the entry on strings. '%' should be listed there with the other mathematical operators. Information on the difference between '+' and '%' and the examples from above should probably be added there as it isn't anywhere else that I can find. The STR entry should be updated because the example is wrong now.

Hope you had a great vacation.

bmanske
Hi Brad,

I have just updated the help file. Thanks for pointing it out, I am doing so many changes in PPL that I always forget to update the help file.
Heh, I should've looked here sooner, I used the "insert" function for this lol.

My code looks like this you can use it if you don't like the other ways, rofl.
Code:

text$=GetText(EDIT104$);
place$=Length(text$);
Insert(num$,text$,place$);
SetText(EDIT104$, text$)


I'll use that "%", my code is stupid.