This forum is locked and will eventually go offline. If you have feedback to share you can find us in our Discord channel "MythoLogic Interactive" https://discord.gg/nECKnbT7gk

Forum rules

minor tweaks for IGame.WriteToConsole()

Here you can find all solved gameplay problems and bugs (beginning from Pre-Alpha 1.8.8).
Forum rules
By using the forum you agree to the following rules. For this forum you also need to follow these additional rules.
Locked
NearHuscarl
Superfighter
Superfighter
Posts: 97
Joined: Thu Feb 07, 2019 4:36 am

minor tweaks for IGame.WriteToConsole()

Post by NearHuscarl » Wed Mar 25, 2020 7:41 am

Remove IGame.WriteToConsole(string message)

I think the new overloading IGame.WriteToConsole(params object[] messages) can cover the old one use cases. I'd like to remove the old one because it conflicts with the new one when printing null value

Code: Select all

Game.WriteToConsole(null); // CS0121 The call is ambiguous between the following methods...
Game.WriteToConsole(null, null); // compliled successfully
WriteToConsole(null) should print the string "null"

Right now it prints an empty string which may be a little bit confusing. It'd be more clear if you can make it returns the word "null" instead
0 x
Image

User avatar
Gurt
Lead Programmer
Lead Programmer
Posts: 1887
Joined: Sun Feb 28, 2016 3:22 pm
Title: Lead programmer
Started SFD: Made it!
Location: Sweden
Gender:
Age: 36

Post by Gurt » Fri Mar 27, 2020 8:10 pm

Fixes after v.1.3.5:
Remove IGame.WriteToConsole(string text) in favor for the new IGame.WriteToConsole(object param[] args) to avoid ambiguous calls between the two.
IGame.WriteToConsole now prints <null> for null values.
IGame.WriteToConsoleF no longer crashes if you input an invalid format, instead a default format will be generated and used.
1 x
Gurt

Locked