[tw] Re: TypeError in MachineGun

2012-01-05 Thread PMario
On Jan 5, 1:50 am, twgrp matiasg...@gmail.com wrote:
 MARIO YOU ARE MY HERO!

 Can I humbly ask, how did you find this? Just by looking at it or via
 some debugging tool or something?
FireFox and FireBug are good friends :)

mGSD tiddlers are editable, even if serverd from the web.
So I just opened your tiddler and inserted some
  code
console.log('1')  -
  code
console.log('2')  -
  code
console.log('3')  lines

close the tiddler and click FIRE to see, how far the code is
executed, since the error stops execution.
It didn't execute the '1' so it was moved up in code. ...

As I knew, which function call causes the problem I did test
console.log('config.act', config.act)
if (story.getTiddler(config.act)) { ...
From my first post, and created the post.

After your second post, I did look a bit closer, if it is save to just
ignore the code inside the evil if. Since the if block above and
below overwrite the same variables (if the named tiddlers exist), it
seems to be save.  I didn't look at the rest of the code.

Since you are happy, it seems to work as expected.

 Thank you
you are welcome :)

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWiki group.
To post to this group, send email to tiddlywiki@googlegroups.com.
To unsubscribe from this group, send email to 
tiddlywiki+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.



[tw] Re: TypeError in MachineGun

2012-01-04 Thread PMario
Hi twgrp,
Since it was working. Can you tell us, what you have done in between?

did a short check:

console.log('config.act', config.act)
if (story.getTiddler(config.act)) { ...

config.act is undefined. So may be some initialisation is missing.
The code is very near the top of the labeled script.

-m

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWiki group.
To post to this group, send email to tiddlywiki@googlegroups.com.
To unsubscribe from this group, send email to 
tiddlywiki+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.



[tw] Re: TypeError in MachineGun

2012-01-04 Thread twgrp
Thanks so much for answering Mario!

I made the demo as clean as possible to avoid involving my convoluted
mGSD because because it has deteriorated over the years [1]. So I
can't really say what I've done over the years.

I think the MachineGun is, or at least should be, independent of the
mGSD-system though. I've used a fresh mGSD (from tiddlyspot) and
except for the MachineGun-necessary plugins I've only imported the
example Projects from Mr. Bairds mGSD demo at http://mgsd.tiddlyspot.com/#Demo

By the way, the password is 'password' if anyone wants to change
things.

 config.act is undefined. So may be some initialisation is missing.
 The code is very near the top of the labeled script.

I did find this a bit further down (under headline /**ACTION**/ )
 config.act=acts[j][0].title;

...is this a definition/initialization?

Thank you!



[1] Clarification: mGSD is a specific application, as opposed to TW
which is generic. The advantage with TW is of course that it is easy
to modify, but personalizing tiddlers that are (mGSD) system specific
makes updates problematic. Years of use means pdates update ALL
tiddlers, ie it is not possible to tell which specific ones have been
updated. This has made me give up on mGSD many times. But because I'm
so fond of TW I find myself hoping to find a solution. Because the
MachineGun, which should be mGSD-system-independent, is so important
to me I'm willing to start over with a clean mGSD if I can just get
this to work.
years of use/modications, in combination with gradual updates, have
made it deteriorate

On Jan 4, 8:11 pm, PMario pmari...@gmail.com wrote:
 Hi twgrp,
 Since it was working. Can you tell us, what you have done in between?

 did a short check:

 console.log('config.act', config.act)
 if (story.getTiddler(config.act)) { ...

 config.act is undefined. So may be some initialisation is missing.
 The code is very near the top of the labeled script.

 -m

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWiki group.
To post to this group, send email to tiddlywiki@googlegroups.com.
To unsubscribe from this group, send email to 
tiddlywiki+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.



[tw] Re: TypeError in MachineGun

2012-01-04 Thread PMario
The whole thing seems to be a bit fragile, because if tiddler MindSet
and Reward are not there, it may also fail. But anyway ...

Short info, why it fails:

if (story.getTiddler(config.act)) {

story.getTiddler() expects a valid tiddler. config.act is undefined,
so the system throws an error message.
we can modify the if () statement, to check the existence of
config.act. If it is falsy, don't touch story.getTiddler.

eg:
if (config.act  story.getTiddler(config.act)) {
 do stuff
}

It checks, if config.act contains a value _different to_ undefined
null false
since config.act is undefined, it stopps executing story.getTiddler()
it skips the do stuff and goes on with the programm


If the programm looks like this, it does something. But as i don't
know, what it should do, I'm not sure, if this fixes it.
This fix (if it is one) is just fighting the symptoms. It may not fix
the init problem.

-m



-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWiki group.
To post to this group, send email to tiddlywiki@googlegroups.com.
To unsubscribe from this group, send email to 
tiddlywiki+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.



[tw] Re: TypeError in MachineGun

2012-01-04 Thread twgrp
MARIO YOU ARE MY HERO!

Can I humbly ask, how did you find this? Just by looking at it or via
some debugging tool or something?

Thank you

:-)

On Jan 5, 12:44 am, PMario pmari...@gmail.com wrote:
 The whole thing seems to be a bit fragile, because if tiddler MindSet
 and Reward are not there, it may also fail. But anyway ...

 Short info, why it fails:

 if (story.getTiddler(config.act)) {

 story.getTiddler() expects a valid tiddler. config.act is undefined,
 so the system throws an error message.
 we can modify the if () statement, to check the existence of
 config.act. If it is falsy, don't touch story.getTiddler.

 eg:
 if (config.act  story.getTiddler(config.act)) {
  do stuff

 }

 It checks, if config.act contains a value _different to_ undefined
 null false
 since config.act is undefined, it stopps executing story.getTiddler()
 it skips the do stuff and goes on with the programm

 
 If the programm looks like this, it does something. But as i don't
 know, what it should do, I'm not sure, if this fixes it.
 This fix (if it is one) is just fighting the symptoms. It may not fix
 the init problem.

 -m

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWiki group.
To post to this group, send email to tiddlywiki@googlegroups.com.
To unsubscribe from this group, send email to 
tiddlywiki+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.