Tired of doing hours of trial-and-error, attempting different values for your script, only to have to wait for reload/recompile between every attempt?
If you answered 'yes' to any of the above, this is the tool for you.
During hundreds of hours of coding sessions, I found myself wasting minutes by the hour waiting for the script to reload so that I could attempt different integer values for things like offsets, stat calibrations, and more. As my game grew, reloading took longer, and I developed a little tool to save me countless hours by allowing me to simply call it with one line from any script, from any game (provided I include the .rpy file temporarily), and allow me to quickly calibrate what I need without having to reload.
So, first, here is the code. Below are the instructions.
Code: Select all
init:
default arg1 = 0
default arg2 = 0
default arg3 = 0
default arg4 = 0
init python:
if not "elem_adjust" in config.layers:
config.layers.append('elem_adjust')
screen elem_adjuster(l1="Arg1",a1=0,l2="Arg2",a2=0,l3="Arg3",a3=0,l4="Arg4",a4=0, alignment=(0.5,1.0)):
layer "elem_adjust"
if a1 or a2 or a3 or a4:
timer 0.05 repeat False action [
If(a1,[SetVariable('arg1',a1)],[]),
If(a2,[SetVariable('arg2',a2)],[]),
If(a3,[SetVariable('arg3',a3)],[]),
If(a4,[SetVariable('arg4',a4)],[])
]
$ form_list = [arg1,arg2,arg3,arg4]
$ arg_list = ['arg1','arg2','arg3','arg4']
$ label_list = [l1,l2,l3,l4]
frame:
background Solid("#000000")
align alignment
xysize (500,500)
vbox:
align (0.5,0.5)
spacing 18
for form_idx, form in enumerate(form_list):
$ lab = label_list[form_idx]
$ arg = arg_list[form_idx]
hbox:
xalign 0.5
spacing 36
vbox:
align (0.0,0.5)
text lab xalign 0.5
text str(form) xalign 0.5
hbox:
yoffset 24
xalign 1.0
spacing 6
$ vbox_list = [[1,-1],[5,-5]]
for idx2, val_list in enumerate(vbox_list):
vbox:
yoffset -24
spacing 12
for idx, val in enumerate(val_list):
$ str_val = (str(val) if val < 0 else "+"+str(val))
use EA_Button(arg,form,val,str_val)
screen EA_Button(arg,form,val,str_val):
imagebutton:
xysize (32,32)
idle Solid("#ffffff90")
hover Solid("#ffffff")
foreground Text(str_val,style="EAdjuster")
action SetVariable(arg,form+val)
style EAdjuster:
size 20
bold True
yoffset 2
color "#222"
What the tool does:
1) The tool places a crude UI on your screen, on the highest layer, with labels and values and buttons for you to manually adjust the values required.
2)The tool creates a new layer called "elem_adjust" in your config.layers, and places it at the end to ensure the tool appears above all of your screens. Note that this should be temporary, once you remove the tool the layer will no longer be appended, and if you run a layer setting in init like I do, your layers will no longer have "elem_adjust" present.
Visually, you will see the value you require being adjusted, and the element on the screen moving.
Here is an example of usage:
Code: Select all
screen test_screen():
frame:
background "some_image.png"
padding (0,0)
align (0.5,0.5)
offset (arg1,arg2) # <--- Here, I use the arguments from the tool, called arg1, arg2.
use elem_adjuster(a1=100, a2=100) # <-- Here, I call the tool with initial arguments 100, 100. Note that a1 is same as arg1.
Install Instructions: Just copy the code above, paste into a new .rpy file, include the file in your game directory.
Uninstall Instructions: Remove both the .rpy and .rpyc files of the tool from your game directory.
Usage Instructions:
1) In your screen or script, set the values you want to change to arg1, arg2, arg3, or arg4 (4 max possible, can set 4 at the same time).
2) Call the elem_adjuster tool, depending on where you call it, the syntax is different.
From screens:
Code: Select all
use elem_adjuster(l1="Arg1", a1=0, l2="Arg2", a2=0, l3="Arg3", a3=0, l4="Arg4", a4=0, alignment=(0.5,1.0))
Code: Select all
call screen elem_adjuster(l1="Arg1", a1=0, l2="Arg2", a2=0, l3="Arg3", a3=0, l4="Arg4", a4=0, alignment=(0.5,1.0))
You can set, or omit, all of the values. The alignment is the position of the elem_adjuster tool on your UI.
l1 through l4 are the titles of the 4 variables you're editing.
3) IMPORTANT: This tool doesn't set your scripts. Once you SEE the values you need on the tool, go change your arg1, arg2, etc. values to the values indicated by the tool.
4) Remember to remove the line where you call the tool.
Hope this is as helpful to others as it has been to me. ^^