I'm trying to update from 1.69 to latest and I'm getting a lot of errors like this:
Assets\AdventureCreator\Scripts\Character\PlayerPrefab.cs(25,15): error CS0101: The namespace 'AC' already contains a definition for 'PlayerPrefab'
Assets\AdventureCreator\Scripts\Game engine\SceneInfo.cs(20,15): error CS0101: The namespace 'AC' already contains a definition for 'SceneInfo'
What's causing these errors, and how can I fix them?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
It's a Unity error, and one that typically shows if you have two scripts or classes with the same name elsewhere in your project.
Do you have a pair of scripts named "SceneInfo"?
Taking a backup first, try deleting AC's Scripts folder before importing the latest.
Thanks, I have no idea what happened but I updated and it's not giving those errors (maybe I reimported the same version?)
I have a few errors now from custom scripts, I believe related to the recent api changes:
Assets\ScummVerbLine.cs(89,36): error CS7036: There is no argument given that corresponds to the required formal parameter '_language' of 'Button.GetFullLabel(Hotspot, InvInstance, int)'
Assets\HideGiveTalk.cs(38,42): error CS1061: 'RuntimeInventory' does not contain a definition for 'IsGivingItem' and no accessible extension method 'IsGivingItem' accepting a first argument of type 'RuntimeInventory' could be found (are you missing a using directive or an assembly reference?)
Assets\Verb1txtVerb2.cs(103,54): error CS1061: 'PlayerInteraction' does not contain a definition for 'GetLabelPrefix' and no accessible extension method 'GetLabelPrefix' accepting a first argument of type 'PlayerInteraction' could be found (are you missing a using directive or an assembly reference?)
Assets\ScummVerbLine.cs(213,62): error CS1061: 'RuntimeInventory' does not contain a definition for 'Combine' and no accessible extension method 'Combine' accepting a first argument of type 'RuntimeInventory' could be found (are you missing a using directive or an assembly reference?)
These seem to be related to a similar change, what needs adjusting to make this work with the latest version?
The Scripting Guide lists all available functions and variables, but I would need proper context to give specific advice.
What are the functions that contain these errors?
I believe they are, respectively:
private void OnHotspotInteract(Hotspot hotspot, AC.Button button) { SetOverrideText(button.GetFullLabel(hotspot, Options.GetLanguage())); }
private void UpdateHotspot(Hotspot hotspot, int selectedCursor) { if (KickStarter.runtimeInventory.SelectedItem != null && hotspot.GetUseButton(1) == null && KickStarter.runtimeInventory.IsGivingItem()) { hotspot.TurnOff(); } else if (selectedCursor == 1 && hotspot.GetUseButton(1) == null) { hotspot.TurnOff(); } else { hotspot.TurnOn(); } }
private void MyUse(Hotspot hotspot, AC.Button button) { textOnEvent = true; if (button != null) { int language = Options.GetLanguage(); newLabel = KickStarter.cursorManager.GetLabelFromID(button.iconID, language) + " " + hotspot.GetName(language); } if (hotspot.GetButtonInteractionType(button) == HotspotInteractionType.Inventory) { int language = Options.GetLanguage(); newLabel = KickStarter.playerInteraction.GetLabelPrefix(hotspot, KickStarter.runtimeInventory.SelectedItem, language) + " " + hotspot.GetName(language); } }
private void OnMenuElementClick(Menu menu, MenuElement element, int slot, int buttonPressed) { MenuInventoryBox inventoryBox = element as MenuInventoryBox; if (inventoryBox != null) { InvItem hoverItem = inventoryBox.GetItem(slot); if (hoverItem != null) { if (buttonPressed == 1) { if (KickStarter.runtimeInventory.SelectedItem == null) { if (KickStarter.playerCursor.GetSelectedCursor() == -1) { hoverItem.RunUseInteraction(useCursorID); } else { hoverItem.RunUseInteraction(KickStarter.playerCursor.GetSelectedCursorID()); } } else { if (KickStarter.runtimeInventory.SelectedItem == hoverItem) { KickStarter.runtimeInventory.SetNull(); } else { KickStarter.runtimeInventory.Combine(KickStarter.runtimeInventory.SelectedItem, hoverItem); } } } else if (buttonPressed == 2) { if (KickStarter.runtimeInventory.SelectedItem != null) { hoverItem.CombineWithItem(KickStarter.runtimeInventory.SelectedItem.id); } } KickStarter.playerInput.ResetClick(); } } }
Here are the complete scripts:
ScummVerbLine: https://www.codepile.net/pile/RDMEXXDQ
Verb1txtVerb2: https://www.codepile.net/pile/J5AXJ47e
HideGiveTalk: https://www.codepile.net/pile/MyObE3q1
Btw, is there some other way of sharing code properly on the forum? I always use the code drop-down menu, but it just does single-line style, is it possible to format it block-style?
Yes - just give your code a tab-indent.
The ScummVerbLine script has been replaced by the ScummInterface script in the Nine Verbs Template package, which has been updated to work with the latest AC release.
The other amended scripts:
Verb1txtVerb2:
HideGiveTalk:
It's not a single part but many throughout. The necessary changes are a result of the overhaul to AC's inventory system, which are covered here.
Thanks, I went through and changed it, I was surprised how close both scripts are, really easy to compare!
I'm having a little trouble with the money script you helped me with a couple of years ago working with the newest version of AC, it keeps replacing my first inventory item with an item with no icon called "1 coins" every time I run the game. This script has never done this until the latest version, so I assume it's to do with the persistent/instance changes?
Also, the verb highlights when I roll my mouse over hotspots isn't working on the latest update. Which script controls that and would need adjusting?
The "count" of an InvItem class now refers to the default amount the Player can carry. For the "live" count value, which is how many the Player is currently carrying, you need to refer to the "Count" of the InvInstance class:
This is incorporated into the ScummInterface script, but the problem is on the AC side. I shall look into it.
T̶h̶a̶n̶k̶s̶,̶ ̶t̶h̶a̶t̶ ̶w̶o̶r̶k̶s̶ ̶w̶e̶l̶l̶!̶ EDIT: spoke too soon, it's still replacing the first item in my inventory with an item called "1 coins" and replacing the icon with None (it retains the cursor icon though).
I'm trying to test out everything to make sure nothing has broken in the 2 AC version jumps, here's my ScummVerbLine changes, it seems to work fine so far: https://www.codepile.net/pile/JGyBPgeD
Glad to know the verb highlights issue isn't this end, let me know what I can do to fix it so I can proceed with testing the rest of the update, thanks!
The above script will only modify the appearance of items that match the ID supplied in the Inspector. If it's applying changes to the first item, and removing its texture, I suspect you either have another instance of the script in your scene - or the original's had its values reset.
The highlight issue has been addressed in the updated template package.
I compared both 1.71.0 and the recently updated 1.72.4 versions, and 1.71.0 does nothing to my inventory (since I'm not using an item that would be adjusted by the money script) and 1.72.4 definitely changes the first inventory item after running the scene once. Nothing changes on the first play, but on the second play, the scene has hard-changed the item.
Which changes were made in the ScummInterface (presumably?) so I can update my own 2016-era modified scumm script to work correctly? Here's the script I'm using: https://www.codepile.net/pile/V4KPl0yE
I tried this, but it doesn't work, this seems to reflect the only changes in ScummInterface: https://www.codepile.net/pile/MO6DxX4g
You haven't shared where/how you're using the money script, but you'd certainly get the behaviour you've described if it's been improperly configured.
Try placing a Debug.Log statement at the bottom of the OnInventoryModify script:
Clicking the message should then reveal its location in the Hierarchy - does it point to where it's expected to be (and only there)?
The changes made to ScummInterface were in the Update loop, with the Menu's SetTargetHotspot function being called.
In my script, I don't have a menu variable as the script itself is placed on the txtVerbLine object. What should
menu.SetHotspot
be inheriting from?I've tried modding the script with the menu and it still doesn't seem to get menu highlights showing: https://www.codepile.net/pile/d2lmnaLa
See the use of the normalColorBlock, highlightedColorBlock and verbElements variables in the official script - they handle the highlighting.
I would recommend incorporating the official script and tweaking as necessary.
I'd love to, I'm just worried about breaking anything else in this precariously balanced set-up I've worked on since 2017 In my script https://www.codepile.net/pile/V4KPl0yE (which I think is based on the original template script unless I'm remembering wrong?) how is the highlighting handled? I did try using the official script, but it didn't seem to work with my original template prefabs.