Name conflict

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
nivlekius
Posts: 105
Joined: Thu Feb 28, 2019 4:39 pm

Name conflict

Post by nivlekius »

Is there anything I can do besides going back through the vast amount of code I've written that use my Item class so that it doesn't conflict with the Dialogue Item class? I can't use mt item class in a sequencer I'm writing and I would REALLY hate to go through and change every reference to my Item class.

Thanks
nivlekius
Posts: 105
Joined: Thu Feb 28, 2019 4:39 pm

Re: Name conflict

Post by nivlekius »

Never mind. I went ahead and changed my class name to GameItem. It didn't take as long as I thought it would to find all the references and nothing got broken by doing so. So all is good.
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Name conflict

Post by Tony Li »

Hi,

Just include the namespace.

The Dialogue System's Item class is in the PixelCrushers.DialogueSystem namespace.

If you haven't specified a namespace for your item class, then it's in the global namespace. In your sequencer command, use global::Item to resolve the conflict.


EDIT: Sorry, we posted at the same time. BTW, if you're using Visual Studio to edit your code, you can right-click on a class name such as "Item" and select Rename. This will automatically rename it anywhere it's referenced in your code.
nivlekius
Posts: 105
Joined: Thu Feb 28, 2019 4:39 pm

Re: Name conflict

Post by nivlekius »

Thanks, yeah I know about the VS stuff but I get leery about doing things like that and getting something somewhere messed up and never finding it or taking forever to find. I didn't think about the namespace though. Thanks.

While we're on the subject, I noticed that I couldn't reference my custom classes in the custom sequencer. Is that the case or am I doing something else wrong? I mean, I was able to get my methods running by using SendMessage to an object I added to my DoNotDestroy game manager, but I was just wondering.

One more thing. So I had to use a string as the sole parameter for my method called with SendMessage. Is this the only way to do it? Is there a way to call my own methods easier and have more parameters? I don't know that I'll ever need it since mostly what I'll be doing is just giving and taking items during quests but you never know.

And thanks, so far I'm loving this. Just trying to get used to new ways of doing things. I had my own system made that was working pretty well but when i started getting deeper into trees it was causing me all kinds of headaches. No matter what I did I could only progress in a linear manner and it was driving me crazy for a week. I finally broke down and bought this. No regrets. Wish I'd have saved myself a week (really longer than that since I made my system a while back and worked on it here and there)
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Name conflict

Post by Tony Li »

nivlekius wrote: Thu Feb 28, 2019 9:28 pmWhile we're on the subject, I noticed that I couldn't reference my custom classes in the custom sequencer. Is that the case or am I doing something else wrong? I mean, I was able to get my methods running by using SendMessage to an object I added to my DoNotDestroy game manager, but I was just wondering.
You should be able to reference your custom classes. You might need a "using" line at the top of the custom sequencer script. If that doesn't help, can you post an example?
nivlekius wrote: Thu Feb 28, 2019 9:28 pmOne more thing. So I had to use a string as the sole parameter for my method called with SendMessage. Is this the only way to do it? Is there a way to call my own methods easier and have more parameters? I don't know that I'll ever need it since mostly what I'll be doing is just giving and taking items during quests but you never know.
The SendMessage() sequencer command is mostly for simple cases, or when the designer really doesn't want to do any scripting. Writing a custom sequencer command is much nicer when you have more parameters.

Tutorial 6 in the Cutscene Sequences tutorial covers custom commands if you have any questions about it. (Or just post here; I'm happy to help.)
nivlekius wrote: Thu Feb 28, 2019 9:28 pmAnd thanks, so far I'm loving this. Just trying to get used to new ways of doing things. I had my own system made that was working pretty well but when i started getting deeper into trees it was causing me all kinds of headaches. No matter what I did I could only progress in a linear manner and it was driving me crazy for a week. I finally broke down and bought this. No regrets. Wish I'd have saved myself a week (really longer than that since I made my system a while back and worked on it here and there)
Thanks! :-)
nivlekius
Posts: 105
Joined: Thu Feb 28, 2019 4:39 pm

Re: Name conflict

Post by nivlekius »

Yeah, I should have been using namespaces from the get go but this is the farthest I've ever gotten on a big project. The little games really aren't much to keep track of.

I think I get everything now. Thanks.
Post Reply