Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 09:15 07 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : passing a value

     Page 2 of 2    
Author Message
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2932
Posted: 12:45pm 24 Jan 2017
Copy link to clipboard 
Print this post

  palcal said   Tried what WW said but with the same Error ??



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 Kingdom
Posts: 2932
Posted: 12:59pm 24 Jan 2017
Copy link to clipboard 
Print this post

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 States
Posts: 1427
Posted: 01:41pm 24 Jan 2017
Copy link to clipboard 
Print this post

I think it would be a lot easier if you change the format of your data.


  Quote  
Essendon = 1
Brisbane = 2
Fremantle = 3
GoldCoast = 4
Carlton = 5
Richmond = 6
Collingwood = 7
Melbourne = 8
PtAdelaide = 9
StKilda = 10
NorthMelbourne = 11
WesternBulldogs = 12
WCE = 13
Adelaide = 14
GWS = 15
Hawthorn = 16
Geelong = 17
Sydney = 18


DIM STRING city.name(18) = (" ","Essendon","Brisbane","Fremantle","Gold Coast","Carlton","Richmond","Collingwood","Melbourne","Port Adelaide","Saint Kilda","North Melbourne","Western Bulldogs","WCE","Adelaide","GWS","Hawthorn","Geelong","Sydney")

for loopa = 1 to 18
PRINT city.name(loopa)
NEXT loopa
PRINT " "

PRINT city.name(WesternBulldogs)
PRINT " "

READ A$, B$
PRINT A$, " " , B$
PRINT " "

DATA "Essendon", "Brisbane"



READ C, D
PRINT C, " " , D
PRINT " "

DATA Essendon, Brisbane


READ A$, B$
PRINT A$, " " , B$
PRINT " "

DATA Essendon, Brisbane


READ C, D
PRINT city.name(C), " " , city.name(D)
PRINT " "

DATA Essendon, NorthMelbourne




This is the output:



Edited by CircuitGizmos 2017-01-25
Micromites and Maximites! - Beginning Maximite
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 01:49pm 24 Jan 2017
Copy link to clipboard 
Print this post

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: Australia
Posts: 6269
Posted: 05:20pm 24 Jan 2017
Copy link to clipboard 
Print this post

  CircuitGizmos said   Not sure why my code isn't colored. Why does it work for TassyJim?

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: Australia
Posts: 1982
Posted: 05:34pm 24 Jan 2017
Copy link to clipboard 
Print this post

@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: Australia
Posts: 1982
Posted: 05:50pm 24 Jan 2017
Copy link to clipboard 
Print this post

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.
PaulEdited by palcal 2017-01-26
"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 States
Posts: 209
Posted: 12:42pm 25 Jan 2017
Copy link to clipboard 
Print this post

Hi Paul;
  palcal said  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
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.
redrokEdited by redrok 2017-01-26
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1982
Posted: 02:42pm 25 Jan 2017
Copy link to clipboard 
Print this post

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: Australia
Posts: 1982
Posted: 11:36am 29 Jan 2017
Copy link to clipboard 
Print this post

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))
Print
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.Edited by palcal 2017-01-31
"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: Australia
Posts: 1982
Posted: 10:30pm 29 Jan 2017
Copy link to clipboard 
Print this post

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: Australia
Posts: 3282
Posted: 11:01pm 29 Jan 2017
Copy link to clipboard 
Print this post

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: Australia
Posts: 1982
Posted: 11:19pm 29 Jan 2017
Copy link to clipboard 
Print this post

@ 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: Australia
Posts: 290
Posted: 11:48pm 29 Jan 2017
Copy link to clipboard 
Print this post

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
  Quote  The main problem with Paul's code is he rates Western Bulldogs greater than Collingwood.
Yep, 2016 was a great year for the pies.....

.
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1982
Posted: 11:59pm 29 Jan 2017
Copy link to clipboard 
Print this post

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.Edited by palcal 2017-01-31
"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: Australia
Posts: 114
Posted: 12:39am 30 Jan 2017
Copy link to clipboard 
Print this post

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: Australia
Posts: 290
Posted: 12:43am 30 Jan 2017
Copy link to clipboard 
Print this post

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.


  Quote  ...yes UP THE PIES...

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: Australia
Posts: 1982
Posted: 12:13pm 04 Feb 2017
Copy link to clipboard 
Print this post

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"
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025