![]() |
Forum Index : Microcontroller and PC projects : passing a value
![]() ![]() |
|||||
Author | Message | ||||
WhiteWizzard Guru ![]() Joined: 05/04/2013 Location: United KingdomPosts: 2932 |
![]() With the SUB as you posted, I get the same error you were getting. But with the 'split' ELSE line I get no error. NOTE: This was just with a 'test' IF.... THEN expression, but the 'unsplit' ... ELSE .... gave the stated error. Let me copy paste your EXACT code and try again on a MM+ (for trying EVAL too). Hang on . . . . |
||||
WhiteWizzard Guru ![]() Joined: 05/04/2013 Location: United KingdomPosts: 2932 |
OK; I have run your code and uncovered something - although not sure if it is a bug (as I've not used EVAL before on the MM range). What is happening is that any team name with a space character included (i.e. Western Bulldogs) will generate the 'Error: Expression syntax' Not sure if this helps you progress . . . Geoff/Peter may need to chime in here. I tried it on MMX v5.3 (Peter: B9v8 200MHz) WW |
||||
CircuitGizmos![]() Guru ![]() Joined: 08/09/2011 Location: United StatesPosts: 1427 |
I think it would be a lot easier if you change the format of your data. This is the output: ![]() Micromites and Maximites! - Beginning Maximite |
||||
CircuitGizmos![]() Guru ![]() Joined: 08/09/2011 Location: United StatesPosts: 1427 |
Not sure why my code isn't colored. Why does it work for TassyJim? Micromites and Maximites! - Beginning Maximite |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6269 |
Magic! And a recent feature added to MMEdit. The main problem with Paul's code is he rates Western Bulldogs greater than Collingwood. I would have an array for the team names an array for team rankings, and another array for the draws. But I know little (and care even less) about footy. Jim VK7JH MMedit |
||||
palcal![]() Guru ![]() Joined: 12/10/2011 Location: AustraliaPosts: 1982 |
@CircuitGismos There are probably other ways to do it but the Data part of the code works fine. Without the 'Sub Selection' it works as intended it was only when I tried to Evaluate the strings that I ran into trouble. WW is on the money it is the spaces in some of the DATA entries. I thought I had removed them all but obviously missed some. Thanks CG and WW for the help I will modify the DATA and see how it goes. Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
palcal![]() Guru ![]() Joined: 12/10/2011 Location: AustraliaPosts: 1982 |
I'm a happy chappy, I worked on that problem for about 4 hours last night and all it was was a few lousy spaces. Thanks again to the helpers, now to get on with the rest. I will keep you posted when the season starts and let everyone know how the Micromite performs against all those die hard supporters. Paul. Edit. I just found something a bit odd, I am using a new Laptop and the < and > are reversed. > means less than and < means greater than. Paul "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
redrok![]() Senior Member ![]() Joined: 15/09/2014 Location: United StatesPosts: 209 |
Hi Paul;I have never seen the < > keys reversed on a keyboard. And I have many. The sequence should be: "B N M < > ?" with a SHIFT and "b n m , . /" un-shifted. I bet you have the two key caps swapped. And the ", ." are reversed too. redrok |
||||
palcal![]() Guru ![]() Joined: 12/10/2011 Location: AustraliaPosts: 1982 |
Just checked the keys, all OK. I don't know what happened, probably me just going crazy. I swapped the > for a < in my code and it ran OK, but later on when I ran the code they were reversed again so I had to change them back. It was rather late but there was no alcohol involved. Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
palcal![]() Guru ![]() Joined: 12/10/2011 Location: AustraliaPosts: 1982 |
Ok My code runs now, but there is a problem with the EVAL function. This is why I thought I had a problem with the < > keys. It was making the wrong selection because the EVAL function sometimes returns zero when it shouldn't. If you run this bit of code you will see the problem DIM teamhome$(10) DIM teamaway$(10) Sydney = 18 'Setup Geelong = 17 Hawthorn = 16 GWS = 15 Adelaide = 14 WCE = 13 Bulldogs = 12 NorthMelb = 11 StKilda = 10 PtAdelaide = 9 Melbourne = 8 Collingwood = 7 Richmond = 6 Carlton = 5 GoldCoast = 4 Fremantle = 3 Brisbane = 2 Essendon = 1 DO z = 1 READ w For x = 1 To 9 ' load the draw for the current week Read teamhome$(x) Read teamaway$(x) Next x Data 1,Carlton,Richmond,Collingwood,Bulldogs,StKilda,Melbourne,Sydney,PtAdelaide,Brisbane,GoldCoast Data Essendon,Hawthorn,NorthMelb,WCE,Adelaide,GWS,Fremantle,Geelong,2,Richmond,Collingwood Data Bulldogs,Sydney,Hawthorn,Adelaide,GWS,GoldCoast,Brisbane,Essendon,WestCoast,StKilda Data Geelong,NorthMelb,Melbourne,Carlton,PtAdelaide,Fremantle,3,Sydney,Collingwood,NorthMelb Data GWS,Richmond,WCE,Geelong,Melbourne,Adelaide,PtAdelaide,Fremantle,Bulldogs Data StKilda,Brisbane,Carlton,Essendon,GoldCoast,Hawthorn for y = 1 to 9 Print Teamhome$(y);" ";Eval(Teamhome$(y)) Print Teamaway$(y);" ";Eval(Teamaway$(y)) Next y z = z + 1 LOOP until z = 3 On the first run through all is OK but on the second and third some of the strings evaluate to zero although the actual variable still has it's original value. Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
palcal![]() Guru ![]() Joined: 12/10/2011 Location: AustraliaPosts: 1982 |
Have been analyzing this a bit more. I found that no matter how many times the test code is run, it is always the same strings that evaluate to zero. Tried reloading the variables with their value on each pass but made no difference. Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3282 |
There is a serious bug in the EVAL() function found by Phil Dobber and it sounds as if it has bitten you also. It only causes trouble when the string passed to the function has more than 31 characters. It will be fixed in Ver 5.03 which is a few days away. Geoff Geoff Graham - http://geoffg.net |
||||
palcal![]() Guru ![]() Joined: 12/10/2011 Location: AustraliaPosts: 1982 |
@ Geoff None of my strings has anywhere near 31 characters. And it works fine the first run through on subsequent passes when the data has been shuffled around (they are the same strings in a different order) I get the problem, and always with the same strings. If I alter the data in the test code above so each set of data IE 1,2 and 3 are all the same order it runs OK. Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
ajkw Senior Member ![]() Joined: 29/06/2011 Location: AustraliaPosts: 290 |
off topic and just for fun. in regards this list Sydney = 18 'Setup Geelong = 17 Hawthorn = 16 GWS = 15 Adelaide = 14 WCE = 13 Bulldogs = 12 NorthMelb = 11 StKilda = 10 PtAdelaide = 9 Melbourne = 8 Collingwood = 7 Richmond = 6 Carlton = 5 GoldCoast = 4 Fremantle = 3 Brisbane = 2 Essendon = 1 The performance numbers seem off... surely 12 beating 13,16,15, and 18 in the finals should have elevated their performance number somewhat. and as for this from TassyJim Yep, 2016 was a great year for the pies..... . |
||||
palcal![]() Guru ![]() Joined: 12/10/2011 Location: AustraliaPosts: 1982 |
That is just how they finished on the ladder and was a starting point to test the code. I plan to implement for and against percentages, home and away, and provision for injuries etc when entering the results. It is just for a bit of fun to have a Micromite in our tipping comp. And yes UP THE PIES they will be at the top by the end of the year. Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
flip Senior Member ![]() Joined: 18/07/2016 Location: AustraliaPosts: 114 |
Hi Paul New member (another) Phil (another Taswegian) here...been playing with EVAL too, I've pasted code that works OK...I doubt the quotes were the issue...but still not 100% sure what problem with yours was I tried lots of ways using different forms of loops etc DIM teamhome$(26) DIM teamaway$(26) Sydney = 18 'Setup Geelong = 17 Hawthorn = 16 GWS = 15 Adelaide = 14 WCE = 13 Bulldogs = 12 NorthMelb = 11 StKilda = 10 PtAdelaide = 9 Melbourne = 8 Collingwood = 7 Richmond = 6 Carlton = 5 GoldCoast = 4 Fremantle = 3 Brisbane = 2 Essendon = 1 For x = 0 To 26 ' load the draw for the current week if x/9 = x\9 then read w Read teamhome$(x) Read teamaway$(x) Next x for y = 0 to 26 Print "Round "; y\9+1; ": ";Teamhome$(y);"(";Eval(Teamhome$(y));") vs ";Teamaway$(y);"(";Eval(Teamaway$(y));")" Next y end Data 1,"Carlton","Richmond","Collingwood","Bulldogs","StKilda","Melbourne","Sydney","PtAdelaide","Brisbane","GoldCoast" Data "Essendon","Hawthorn","NorthMelb","WCE","Adelaide","GWS","Fremantle","Geelong",2,"Richmond","Collingwood" Data "Bulldogs","Sydney","Hawthorn","Adelaide","GWS","GoldCoast","Brisbane","Essendon","WestCoast","StKilda" Data "Geelong","NorthMelb","Melbourne","Carlton","PtAdelaide","Fremantle",3,"Sydney","Collingwood","NorthMelb" Data "GWS","Richmond","WCE","Geelong","Melbourne","Adelaide","PtAdelaide","Fremantle","Bulldogs" Data "StKilda","Brisbane","Carlton","Essendon","GoldCoast","Hawthorn" Phil |
||||
ajkw Senior Member ![]() Joined: 29/06/2011 Location: AustraliaPosts: 290 |
Hi Paul, I did realise the numbers represented the end of the home and away position , I just had to mention what happened in the finals. I look forward to seeing this go forward, another interesting use of a mite indeed. yep, plenty of room to go up from 7 out of 18... Can Buckley get a flag?? Cheers, Anthony. |
||||
palcal![]() Guru ![]() Joined: 12/10/2011 Location: AustraliaPosts: 1982 |
Loaded 5.3.02 and all is now working OK THANKS GEOFF. Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |