Got a question, I've been trying to incorporate accessing the viewer in my custom quick_menu, but so far failed in locating how to open it other than by the hot-key combo.
Well, it's because strictly speaking you can't, because it's opened by a protected method from a protected object:
AONutils.keyBind.add( "VVEOpenning", "alt_K_u", self.__openVVE, isA=AONutils._CODE_ )
But:
self
is nothing more that a variable that, by convention, have a particular name and that point to the object. So, it's nothing more than
objectName.methodName
.
Rest the issue with the "protected" part. For Python, "protected" have two meanings:
At object level, it mean that the method/variable will not be directly available. The name will be prefixed by "_className".
At module level, it mean that the object/function/variable will not be importable. But the name stay the same.
And here, there's the two
So, first you need to know the name of the object. In the present case there's a trick... The "AONvve" module have an object named "AONvve", but it's the interface, not the core
But if you do a
sorted( dir( AONvve ) )
, you'll find an object named "__mySelf", it's what you are searching for.
Then if you do a
sorted( dir( AONvvve.__mySelf ) )
, you'll find a method named "_MySelf__openVVE".
Therefore,
AONvve.__mySelf._MySelf__openVVE()
(module.object.method) will open the viewer.
Now, all this is the proper way, and as you can see, while not too complicated, it's also not as easy as that. I mean, I gave you the name of the core object and the right method, but normally you would have to check all the variables in the module, until you find one that is an object and have the method you search for.
But with Ren'Py there's another way, that don't need to starts digging in the internal.
As you said, there's a key combination that do it. So you can look at
sorted( config.keymap.keys() )
, and find "VVEOpenning" (yeah, I know, why the hell did I put two "n", I don't know). Alternatively you can look directly at
config.keymap
to search by key combination.
Now, you just need to address the right key in
_default_keymap.keymap
, to access the associated code. Therefore,
_default_keymap.keymap["VVEOpenning"]()
will also open the viewer.
Put one or the other in your tweaked quick menu, and I don't see why it shouldn't works.
Side note:
I haven't forgot you,
UncleVT . But I know that broken save can be really annoying, so I'm trying to find a way to secure the save.
Something that would intercept the exception, then remove the viewer from the save and save again ; while warning the player about the issue. That way, both the game and viewer would be still working, and the player would be able to continue saving his progress. Right after a load, the viewer would give inconsistent results (unless I'm smart and remember to fake an opening through the "after_load" label), but it would works fine again starting the second call.
But the issue is that all this need to works while not going in an endless loop because the save would be break by the game itself and not by the viewer.
I know it's doable, I just need to find how.