How to avoid running a script / displaying JS link on start section

DaxAtDS9
12 Jul 2018, 10:12

Hi!

I've found a nice solution to implement an inventory system (better than mine ;-) ) in that closed post:

https://textadventures.co.uk/forum/squiffy/topic/ek5beopywuqur_qnhhoigg/going-back-to-previous-sections-back-link-history

The last line says:

sectionLink('inventory', 'inventor');

That line is displaying a link to an "inventory".
But I think it doesn't make sense being displayed an startscreen. "[[]]:"

Anyone a solution to make it:

"if NOT startscreen than display inventory link"

Sorry, I learning JS already... :-D


DaxAtDS9
12 Jul 2018, 10:20

Found it! :-)

if (history != 'sectionname') {
    sectionLink('inventory', 'inventory');
}

If NOT in sectionname than display - where sectionname is startscreen [[]]:


loopernow
13 Jul 2018, 03:00

That's awesome!


ahmed22
28 Jul 2018, 08:36

nice work man i was also having this problem