Snippets

SinnyStar [Ren'Py] Automatically scroll to the bottom of a viewport

Created by J. Tran

File screens.rpy Added

  • Ignore whitespace
  • Hide word diff
+init python:
+
+    class NewAdj(renpy.display.behavior.Adjustment):
+        def change(self,value):
+            if value > self._range and self._value == self._range:
+                return Return()
+            else:
+                return renpy.display.behavior.Adjustment.change(self, value)                
+
+    # The adjustment
+    yadj = NewAdj()
+
+    # The Python function to scroll to the bottom                
+    def scroll_bottom():
+        yadj.value = yadj.range
+        
+    # Action equivalent
+    class ScrollToBottom(Action):
+        def __init__(self):
+            self.adj = yadj
+        def __call__(self):
+            self.adj.value = self.adj.range
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.