Jump to content

skylinoob

Member
  • Content Count

    6
  • Joined

  • Last Visited

Community Reputation

1 Recognised

About skylinoob

  • Rank
    Freshman

Recent Profile Visitors

155 Profile Views
  1. Coding Issue

    after Trying with DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, $"relocated for id {id}"); i get the same invalid adress error (like i'm trying to use some "non existing anymore " resource... output_log https://pastebin.com/5s95iGQX error.log https://pastebin.com/hXNVVCaq This still doesn't make sense to me as : the life cycle of var s in void whatever (ushort a){ string s = "local var"; DebugOutputPanel.addMessage (s); } is from void whatever first line to void whatever last line the life cycle of $"relocated for id {id}" is from that call to the end of the call (ie end of DebugOutputPanel Also $"relocated for id {id}" should normally be calculated before the call to debugoutputpanel and should be free when this function return (returns void in DebugOutpuPanel.addMessage but still returns). I don't often code in c# (my last experience is pretty old) but i guess the var s in the first case is passed by value and not by ref; if so there is no real difference between DebugOutputPanel.addMessage (s); and DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, $"relocated for id {id}"); in both case a memory space for the length of the string should be allocated before calling DebugOutputPanel.AddMessage (for s it will be just a memcopy while for $"relocated for id {id}" it will resolve the expression and then do the assigning) and the adress of this space must be given as argument to the call to DebugOutputPanel.AddMessage and that memory would be release when the DebugOutputPanel.AddMessage will return... So i'm still lost ;( Btw for my dev i now use modtools so my issue is solved in a way but i still would like to understand the error here. Ty for your time guys
  2. Coding Issue

    u might have heard about it if u're using modtoools by mr bloodypenguin when u start the game press F7 scroll on top and see the blue text claiming that "you should no longer use DebugOutputPanel"
  3. Coding Issue

    indeed i'm not . this code is just a first attempt so i used a minimal config (well i got visual studio but i even let cityskyline compile my source code by itself as i noticed a framework version difference betweeen my visual studio compiler and the game one. For exemple my visual studio (even though the project is configured for .Net3.5 supports expression like : public string Name => "Whatever"; while the game compiler doesn't understand that notation and wants a public string Name {get {return "Whatever";} } I will try modtools ty So after trying with modtools it works as expected ty; but i would still want an explanation from anyone who has an idea about that issue. so the issue is simple to sum up : void whatever (ushort a){ string s = "local var"; DebugOutputPanel.addMessage (s); } IS WORKING (yes i tried taht too) void whatever (ushort a){ DebugOutputPanel.addMessage ("LitteralString" + a.toString()); } IS CRASHING !! void whatever (ushort a){ Debug.Log ("LitteralString" + a.toString()); } IS WORKING !! I'm kinda lost here.. someUnsignedShort.toString () should never crashes as the content of the memory pointed by someUnsignedShort can be interpreted as an unsigned short whatever is value is and an unsigned short can always be converted to a string (without unsafe operations (except the allocation of the returned string.. would that mean DebugOutputPanel.addMessage call is taking all available memory ? leaving nothing for that string allocation ?? sounds crazy... Not even taht is possible btw as this is a static call... i'm really lost ;( so sad))
  4. Coding Issue

    from my understanding Debug.Log is the generic function (ie unity native function) and DebugOutputPanel.AddMessage is the skyline api wrapper for debug.log (after testing it's more than that as debug.log doesn't output in the ingame panel shown by pressing F7) after testing with debug.log it doesn't crash anymore ty dude but the good thing about debugoutputpanel is i had debug result ingame by presssing F7 (which show/hide that famous debugoutputpanel) . I guess with debug.log it's a real debug output (ie in console) if so the main diff is i would have to attach my process to a debugger to get such console ? sorry i'm pretty new to unity i'm more familiar with godot (open source alternative) oh and finally why was i using debugoutputpanel ? cause it's what they do in the modding wiki and any hello world exemple i saw..
  5. Coding Issue

    no disrespect but it seems so. well, like that, i can't think of any language using & for concatenation... php uses dot shell uses && in c /c++ u use it to get the adress of a variable or to mutliply bits (ie bitwise AND operator) but in c# afaik it's only for bitwise AND ; and yes i'm sure string concatenation is done with + operator also in the parenthesis if a non optional parameter was needed the compiler would not compile I didn't check but i guess i can put an optional parameter to specify the basis (like decimal which is default, binary, hexa...)
  6. Hi guys can anyone help me with that issue i don't get it... using ICities; using ColossalFramework.Plugins; namespace Whatever { public class Whatever : IUserMod { public string Name => "Whatever"; public string Description => "it does somethin"; } public class Loader : LoadingExtensionBase { public override void OnLevelLoaded(LoadMode mode) { DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, "hopla"); } } public class BuildingListener : BuildingExtensionBase { public override void OnBuildingRelocated(ushort id) { base.OnBuildingRelocated(id); DebugOutputPanel.AddMessage(PluginManager.MessageType.Message,"relocated for id " + id.ToString()); // this is the line crashing the game note that without the " + id.ToString()" it works } } }
×