unknown error in script

5 views
Skip to first unread message

Seba

unread,
Sep 23, 2010, 7:49:04 AM9/23/10
to TiddlyWiki
Hi,

I have problem which I can't really determine:(

I've created a tool for a game which helps keep track of things to do
and so on.
I want to share it with anyone who would like to use it as an
unofficial addon to the game. For that purpose I've set it up in a way
all one needs to do is point and click without ever having to enter
the edit mode.

However, there is a problem:)

For creating a new tiddler from a button inside a tiddler which adds
the title of source tiddler as a tag I have this:
----------------------------------------------------------------
<script label="New quest">
var alwaysTag="quest";
var tid=story.findContainingTiddler(place);
tid=tid?tid.getAttribute('tiddler'):'';
var charTag=(tid).toLowerCase();
var p=prompt("Enter the quest name","");
//return
var title=(p);
var tags=(alwaysTag+" "+charTag);
store.saveTiddler(
title,
title,
store.getTiddlerText('questTemplate'),
config.options.txtUserName,
new Date(),
tags);
story.displayTiddler(null,title);
</script>
-----------------------------------------------------------------
Please look at the //return if I remove the // the button doesn't
work. However I need the return function so that user can abort the
creation of a new tiddler without affecting the entire tiddly.

Please have a look at the tool:

http://users.volja.net/adonis25/estiah.html

Go to Kuharcek->New quest or just select edit while in Kuharcek.

I hope this wasn't to confusing.

thx

regards,
seba

Tobias Beer

unread,
Sep 23, 2010, 8:04:47 AM9/23/10
to TiddlyWiki
I guess what you want is not a return statement on it's own but
instead a...

if(!p)return;

Other than that, you could put the entire script in another tiddler
and call it "NewQuest" then transclude it in your games with...

<<tiddler NewQuest>>

Cheers, Tobias.

Seba

unread,
Sep 23, 2010, 4:27:14 PM9/23/10
to TiddlyWiki
...worked like a charm:)

thx a lot
regards,
seba

Seba

unread,
Sep 23, 2010, 4:37:59 PM9/23/10
to TiddlyWiki
One more thing and since its about the same tool, I didn't want to
post new.

Main menu will not refresh even-though I've put autorefresh in
viewtemplate and I tried puting it in main menu as well.
When I create a new character it is not displayed in main menu untill
I refresh the page. However autorefresh works fine on other tiddlers.

Any thoughts?

regards
seba

Tobias Beer

unread,
Sep 23, 2010, 7:15:55 PM9/23/10
to TiddlyWiki
Hi Seba,

Add force='true' to your PageTemplate...

<div refresh='content' tiddler='MainMenu' force='true'></div>

Cheers, Tobias.

Seba

unread,
Sep 24, 2010, 4:30:53 AM9/24/10
to TiddlyWiki
Again, thx, works great.

regards,

seba
Reply all
Reply to author
Forward
0 new messages