NathanGuilhot/yet-another-phone-for-renpy

MC_Name will not work when the player defines the name

Closed this issue · 4 comments

When the user defines the name for the MC, the system cant compare d.who to MC_Name = "[mcname]"

Example:
define MC_Name = "[mcname]"

if d.who == MC_Name:
$ message_frame = "phone_send_frame.png"

So phone text shows up as both people being the responders.
image

Hi! Thanks for the issue; it's a good catch!
That's because the "define" statement is only ran when the game is initiated; so when the player start a new game, and thus didn't yet choose their name.

Since the variable MC_Name is only used in the nvl_phonetext() screen, we can move the variable over there like this:

# line ~71
# The actual messenger screen
screen nvl_phonetext(dialogue,items):
    default MC_Name = "[mcname]"

    # ....

That should do the trick! Let me know if that work for your situation.

  • Nighten

Thanks for the quick response.

Unfortunately this did not work for me, I think leaving the MC_Name in place and giving it a generic "MC" variable wont matter since the icon and layout should be the same,

Hum... It's hard to tell what goes wrong without seeing how you let the user define their name; But I think I found something.
Is mcname a character or a raw string? If it's just a string you can directly do MC_Name = mcname. Renpy does data interpolation (aka replace what's in [ ] by the variable value) only in certain places; and apparently not when declaring a variable like this. So the code then try to compare the character's name to a string "[mcname]", and not the actual value of mcname.
That's my best bet, I hope it'll help!

Hi back,
My baby came in early unpectedly and had me put all my work on pause.
I also had to revisit the code and remember what i was doing.

Anyways im using a variable and defining the character as below:

$ mcname = renpy.input("enter name")