Skip to content

Comments

textblocks#169

Open
Pertex wants to merge 2 commits intotextadventures:mainfrom
Pertex:main
Open

textblocks#169
Pertex wants to merge 2 commits intotextadventures:mainfrom
Pertex:main

Conversation

@Pertex
Copy link
Collaborator

@Pertex Pertex commented Jan 28, 2026

Hi Alex,
I played around with the code a bit with the help of AI and implemented the text blocks I mentioned earlier.
Maybe you can use it, if not, just delete it. That's how I imagined it.

Adding textblocks to the setting menu and to the editor "Add..." menu
Blocks can added to the game by choosing them in the Add...-menu or by pressing ctrl+shift+1 (+2, +3...). Hmmm, the keyboard shortcuts will ony work on Window-systems, I suppose.

Blocks can added to the game by choosing them in the Add...-menu or by pressing ctrl+shift+1 (+2, +3...)
@alexwarren
Copy link
Contributor

Interesting. At the moment I'm not fully clear how this would be used. What are some examples of the text blocks you use yourself - are they templates for using some Handlebars helpers for example? I can certainly see we could have some way of integrating those a bit better, though I don't think it should be up to game authors to have to configure these all themselves.

@Pertex
Copy link
Collaborator Author

Pertex commented Feb 22, 2026

There is text I often use in my Squiffy5 game ( but will be the same with Sq6)
Something like

{@quest_xxxx=1}[Neue Quest erhalten](Questbuch)}
{if xxxUserName=empty:Abenteurer!}{else:{xxxUserName}!}
{@quest_xxxx=3}{@score+=1}[Quest erfüllt](Questbuch)}

or even complete sections:

[[5252FlussAngeln]]:
    const fische = squiffy.get('fishing');

    if(squiffy.get('fishingAktuell')!=null){
        squiffy.ui.write('Ein kleines Angelpäuschen wäre jetzt nicht schlecht, aber Du trägst noch einen Fisch mit Dir mit.');
    } else if(squiffy.get('quest_fishing')!='1'){
        squiffy.ui.write('Du könntest hier angeln gehen, aber was solltest Du mit dem gefangenem Fisch machen?');
    } else if(fische!= null && fische.includes("5252Fluss")){
      squiffy.ui.write('Du hast hier schon einen Fisch gefangen. Probiere, anderswo einen anderen Fisch zu fangen!');
    } else if(squiffy.get('inventar_angel')=='1'){
           squiffy.ui.write('Du setzt Dich ans Ufer und wirfst Deine Angel aus.'); 
           squiffy.set('_sectionToGo','5252Fluss');
           setTimeout(function (){location.href = "https://heroica.xxxx.de/fishing/index.html?level=wtz";}, 1000);
    } else {  
        squiffy.ui.write('Im Wasser schwimmen viele Fische herum, doch ohne Angel wirst Du nicht an sie heran kommen.');
    }

[[Hier aktualisieren]](5252Fluss)

I must always search the code to copy and paste it to the new sections

@alexwarren
Copy link
Contributor

Ah ok, so this is specific to each game, rather than something that you would use across different games?

I wonder if maybe we could have a way of defining these "macros" in the game source file itself. You could always copy macros across to other game files too if they're useful there.

@Pertex
Copy link
Collaborator Author

Pertex commented Feb 22, 2026

yes, most codeparts would be specific to a game.
“Macros” sound interesting, even though I can't imagine how they would work right now.

@Pertex
Copy link
Collaborator Author

Pertex commented Feb 22, 2026

These should not be functions that can be started for execution, but rather the code must be copied to the actual location. The code is then adjusted manually.

@alexwarren
Copy link
Contributor

Got it. "Macros" was just me suggesting a name, I think these would just be static text. A better name is "snippets" - looking into implementing this now..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants