Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

I'm going to assume you mostly want to use this to display the contents of Fields, so....

General explanation of how to repurpose this:

This contraption looks at the script of each of widgets that you name inside of it's properties window. 

Literally, it's looking at the .script attribute of other widgets (or cards, the deck, etc) and displays them as plain text. 

To display the contents of Fields instead we'll need to change the prototype script to look at the .value or .text of the named widgets and allow the Field inside the contraption to display Rich Text (if we want that).

As a reminder:

.text is for plain simple text (no fancy business). 
 .value  (when we're talking about Fields) refers to Rich Text with the possibility of font changes, colors, links, inline images and so on. 

(I'm assuming you want Rich Text so I'll use .value in my example.)

Practical explanation of how to edit it:

If you go inside the prototype of the contraption (File > "Prototypes..." or select a copy of this contraption, open it's properties and click "Prototype...") and look at it's script (Prototype > "Script..." from the menu bar)... well, there's a lot of neat stuff going on. But we only need to change two things in here.

Inside the "on change do" section of the prototype script, change...

target[].script:scr.text 

 to 

target[].value:scr.value

Then... towards the bottom of the "on view do" further down in the script, look for the second-to-last line and change...

scr.text:target[].script 

to

scr.value:target[].value 

Finally... change the field named 'scr' inside of the contraption (it's the widget with a scroll bar) to display Rich Text by opening it's properties menu and clicking that option.

Hopefully that's all you need! Please let me know if it doesn't work, haha.

A backup plan:

If you don't want to edit it yourself you can grab the "sceneViewer" contraption out of the unlocked .deck file of this project.
(It's just the scriptViewer contraption with the changes I mention above.)

(+1)

Thank you so much, Ahmwma! This is exactly what I needed; works like a charm. Also a big fan of your work :)

(+1)

You're very welcome and likewise! Looking forward to seeing what you come up with next.

(2 edits) (+1)

Hey ahmwma,

I’m finally finishing up this project, but I’ve run into a slight problem with your scene viewer contraption. The first tab does show the appropriate named field’s contents, but I find that I’m unable to click the other tabs. Do you know why the tab buttons are unable to be toggled? I feel like maybe I’m just not understanding the purpose fully.

For reference, I’m trying to use the scene viewer to toggle between three sets of text. One field per tab:

image.png

(+1)

Hey Salty!

I've been poking at the contraption and only managed to break it in the way you mentioned once. I think something may have happened to the 'on click pos do' event handler inside the contraption? This is the final event handler in the contraption's script, as it (probably) should be:

on click pos do
 v:get_options[]
 w:(.7*c.size[0])/count v
 set_value[v[floor(first pos)/w]]
end

If this event handler isn't there to do something with clicks, then clicking the tabs doesn't do anything.

So that would be the first thing I'd check. 🤔 But also, since your actual writing is safe in their own fields you could also remove the contraption and bring in a fresh copy. (Or take a working copy and give it a higher version number so it automatically replaces the old ones when you paste it in...? I think that's how that works. Save your deck first for safety!)

(And your project looks really neat!)
(+2)

I actually went through and triple-checked the properties of the contraption with the one in your deck. I couldn’t find any differences in scripting or properties.. I even re-imported it and purged the old ones. I am utterly confused! I will have to come back to this tomorrow and see if I can figure out what’s going wrong.

I appreciate your help, as always.