Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(3 edits)

Yeah, I specified that I didn't change spaces in the actual code because I did add line breaks here (to prevent it going off the side of my screen when I switched it to Code Mode there).  I'm aware that spaces can be functional; they aren't in most of the languages I've used, but since Godot/GDScript uses indentations functionally I presume that all whitespace is potentially functional and I'm careful about not messing with it (my brain is pretty well specced to grasp open/close mechanics such as parentheses and nesting -- that's the very thing that those classmates in college were messing up all the time, pasting code into random spots and breaking the nested logic of the original code).

ETA: And yes, I am very careful about the distinction between tabs and spaces.  I'm using tabs in the code for all the indentations -- they don't just look similar, they are equivalent even in the whitespace.

Here's my code (again omitting Anchors and Margins, for brevity).  Again, these are in the exact same files, matching the original code exactly, including the white space (the line breaks have been added here purely for readability, and are not used in the code); the only thing I have changed is the variable names (carefully matched in logic to the original set of names), obvious Strings, and some If/Then logic that shouldn't impact the buttons themselves, just the text displayed (I even commented it out with a test string instead, to be sure it wasn't screwing things up).

##############################################
#### Testing to see if I can add a button ####
##############################################
[node name="namechange" type="Popup" parent="MainScreen/slave_tab/stats"]
size_flags_horizontal = 2
size_flags_vertical = 2
[node name="TextureRect" type="TextureRect" parent="MainScreen/slave_tab/stats/namechange"]
texture = ExtResource( 44 )
expand = true
[node name="Label" type="Label" parent="MainScreen/slave_tab/stats/namechange"]
size_flags_horizontal = 2
size_flags_vertical = 0
text = "What name should $name respond to?"
align = 1
[node name="namechangeconfirm" type="Button" parent="MainScreen/slave_tab/stats/namechange"]
size_flags_horizontal = 2
size_flags_vertical = 2
text = "Change Their Name"
[node name="LineEdit" type="LineEdit" parent="MainScreen/slave_tab/stats/namechange"]
size_flags_horizontal = 2
size_flags_vertical = 2
caret_blink = true
##################
#### END TEST ####
##################
##############################################
#### Testing to see if I can add a button ####
##############################################
[connection signal="pressed" from="MainScreen/slave_tab/stats/namechange/namechangeconfirm"
to="MainScreen/slave_tab/stats" method="_on_namechangeconfirm_pressed"]
##############################################
#### Testing to see if I can add a button ####
##############################################
#### Function called when new button gets pressed:
func namechange():
get_node("namechange").popup()
get_node("namechange/Label").set_text(person.dictionary("What name should $name respond to?"))
get_node("namechange/LineEdit").set_text(person.name)
get_node("namechange/LineEdit").set_placeholder(person.name)
#### When new button gets pressed:
func _on_namechangeconfirm_pressed():
get_node("namechange").visible = false
var text = ""
text = "Yes, $master."
#if person.obed < 35: ## Not yet broken
# if person.conf > 30:
# text = "— You can't just take my name away!"
# else:
# text = "— Are you really going to take even my name away??"
#elif person.obed > 70: ## Highly obedient
# text = "— Of course, $master.  Every part of me exists to serve your will."
#else: ## Moderate, compelled obedience
# if person.conf > 60:
# text = "— I guess I don't have much choice."
# else:
# text = "— Yes... $master."
person.name = get_node("namechange/LineEdit").get_text()
get_tree().get_current_scene().close_dialogue()
get_tree().get_current_scene().popup(person.dictionary(text))
## Testing to see if I can add a button
buttons.append({text = person.dictionary("Change Name"), function = 'namechange'})

So yeah, I don't think I missed something as simple as using the wrong name.  And since changing the original names (in both files) to blahCallOrder and blahCallOrderConfirm completely broke the original sections that were working, and since none of the other files in either directory reference these variables, it definitely feels like I'm missing a piece that needs to get accounted for elsewhere.

Also, I included the buttons.append line exactly as you quoted, in my "samples of my code" at the end of my first post there.  Just added it to here for completion.  Really wish the code formatting let me include line breaks, this wall of text stuff is killing me.

(3 edits)

I don't see any problems with the code as presented, including the commented out code. Probably due to itch.io formatting you are missing leading whitespace in the functions so I'll have to take your word that it is not an issue. You haven't specified if you are using the Debug mod or the editor, so I can't rule out the possibility of a tangentially related error somehow sabotaging you.

Itch.io code can be formatted but it doesn't play nice with copy and paste. Edit: seems extra lines really don't work, though adding a space to them works.

code
code after extra line break
    code after tab
 
code after extra line break with space


If we assume that there are no errors, then we will have to get creative in looking for the source of the problem. Please verify that you are not editing the files in the "backup" folder for Strive as those files are 100% copies but are not used except to replace the game's files whenever the mod system applies or resets mods. Note that any changes you have made to the non-backup files will be erased if you use the mod system, and the Debug mod doesn't actually use the mod system. Additionally if you have made your own copies of the files, make sure that the game is using files with your latest changes. Finally, I've had people report in some cases that editors like Notepad++ were somehow editing something like copies of files rather than the actual files so their edits had no effect, though I've never had this happen to me.

Using the Debug mod or editor it is possible to use print() to get direct feedback as to the state of the program in functions, which can be more useful than relying on the Game's GUI to behave as expected. The game also has a system designed for file based trace statements in globals.gd, but those are more helpful for dealing with crashes.