| View previous topic :: View next topic |
| Author |
Message |
MaxMunro
Joined: 06 Jun 2008 Posts: 31
|
Posted: Sun Oct 25, 2009 1:20 am Post subject: Help with some finer points of HECL please |
|
|
Hi guys. I'm doing a hiking CMS that I hope to share shortly.
I thought I had the hang of HECL, but keep getting an 'Exception' on the screen - wonder if anyone can help?
#1. I set some previously defined variables ....
set mm::naismith-kph {3.0 3.5 4.0 5.0 5.5 6.0 6.5 7.0};
set mm::naismith-m100 {9.9 9.9 9.9 9.9 9.9 9.9 9.9 9.9};
set mm::i 0;
2. I attempt to work with the lists (assume the formulae are correct and that there's no division by zero)....
for {set mm::i 0} {< $mm::i 9} {incr $mm::i} {
set naismith-t1 [/ $cms::dist-t [lindex $mm::naismith-kph $mm::i ];
lset naismith-m100 $mm::i [/ [-$mm::timer-elapsed [* $mm::naismith-t1 3600]] [* 0.6 $mm::CumUp10]];
}
3. Then I try to print it out with a scriptlet
<area x="120" y="106" w="40" h="22" font="mm-16" align="left">
<script>print [lindex $mm::naismith-m100 2]</script>
</area>
This gives an 'Exception' Syntax problem? Any help in preserving my sanity greatly appreciated ! |
|
| Back to top |
|
 |
vincent
Joined: 11 Feb 2008 Posts: 196
|
Posted: Sun Oct 25, 2009 7:23 am Post subject: |
|
|
after a fast look at :
missing one braket
t1 [/ $cms::dist-t [lindex $mm::naismith-kph $mm::i ];
and on your xml file :
use instead for example :
<area x="356" y="428" w="63" h="19" font="smurf_digi_mc" align="right">
<value>{$vinc::speedbeammax}</value>
</area>
where you set this variable in your code with the lindex.
but if you succed to print ... take me an MP !
and... personnaly I don't use ";" in my code ...  _________________ SE K750i + 512MB MS2 OR HTC Diamond + Qstarz BT-818 + Wintec 301 + latest TB |
|
| Back to top |
|
 |
MaxMunro
Joined: 06 Jun 2008 Posts: 31
|
Posted: Sun Oct 25, 2009 3:16 pm Post subject: |
|
|
Thanks Vincent - much appreciated.
1. missing bracket
2. in the scriptlet, I am trying to print a specific item from a list created in the hecl code - I think this requires some sort of scriptlet???
3. am also having a problem with exposing cms::dist-t in the hecl code (as indicated below - says variable not defined), but I noticed you mentioned probelms with this on a recent post, and perhaps i need to upgrade from 0.9.84....I'll try this now. (using a blackberry 8310)
Thanks from diverting from your TB programming activities!!
--------------------------------------------------------
var cmsdist 0
proc mm::onLocationUpdated {} {
set mm::cmsdist $cms::dist-t
}
proc mm::onTrackingStart {} {
set mm::cmsdist 0
}
proc mm::onTrackingStop {} {
}
------------------
<area x="5" y="170" w="315" h="20" font="small" align="left">
<value>mm-cmsdist: {$mm::cmsdist}</value>
</area> |
|
| Back to top |
|
 |
vincent
Joined: 11 Feb 2008 Posts: 196
|
Posted: Sun Oct 25, 2009 3:27 pm Post subject: |
|
|
1 - as usual with hecl code !
2 - affect the item list value to a global variable and use this globa varaible inthe xml . that's much simpler to read the xml code.
3 - using $cms::dist-t without any problem. yes perhaps you should upgrade to the 0.9.90
the problem I got with this var is that the value of dist is not updated in each update location ... so it give me false results when used to compute average speed for example.
but before upgrade, you also could declare the same var name that you use in functions  _________________ SE K750i + 512MB MS2 OR HTC Diamond + Qstarz BT-818 + Wintec 301 + latest TB |
|
| Back to top |
|
 |
MaxMunro
Joined: 06 Jun 2008 Posts: 31
|
Posted: Sun Oct 25, 2009 3:39 pm Post subject: |
|
|
Thanks again Vincent.
Yes - cms:: dist-t now showing, although I also had to inset mm:: in the following statement:
var cmsdist 0
Re dist-t updating, it seems to update on some combination of a) time and b) incremental distance travelled..
Cheers. Max.  |
|
| Back to top |
|
 |
|