ADRIFT Forum


The place to discuss the ADRIFT Interactive Fiction toolkit

Module Import problem

This forum is the place to learn about and discuss ADRIFT 5. Feel free to mention any bugs you find here, but please also add these to the Bugs & Enhancements list.

Please also refer to the ADRIFT 5 Wiki for more information.

Module Import problem

Postby DazaKiwi » Thu Feb 15, 2018 2:42 am

I've been making a simple but effective shop buy and sell system, its completed and runs fine. However when i export folder and import it into a new game, when i go to run game (that is 1 location game as a test as well as earlier when i setup some shop locations and a trader and goods etc) i get a couple of errors pop up.

1# Tool Click error: Object reference not set to an instance of an object
2# Startup error: Object reference not set to an instance of an object

I haven't encountered this before with exporting modules. And as i said the demo where this module was exported from works fine, the module has 1 parent folder so there isn't missing tasks or object (only 1). I compared all the files in the module folder to the imported version and everything is there.

Here is the module in question: (let me know if its not accessible)
http://www.mediafire.com/file/7a1jox6ves99p9v/Buy_Sell_Demo_Mod2.amf

What sort of problems can you have with startup that? I mean usually you get errors when tasks called up by player input during a game if there is some bad references you get errors when that task runs. So what kind of startup sequence would throw an error like i mentioned? or did some kind of corruption occur when i exported my module? I did try exporting it again.

This buy and sell module was designed to be dropped into a project so there is only 1 object in the module which it references its propertykey and that is present in the import test i made.

If i can get this fixed i was planning on making it available for the community.
User avatar
DazaKiwi
 
Posts: 524
Joined: Thu Oct 21, 2010 9:05 am
Location: New Zealand
Points: 16

Re: Module Import problem

Postby DazaKiwi » Thu Feb 15, 2018 9:25 pm

I have found the culprit. It was my 'Inventory (Custom)' task, which is a Specific task to Override Inventory. I added two descriptions there, one of which was be the offender..with a restriction of "backpack must be visible to Player" <-- this caused the error. Have no idea why.

*update* :x

The point of this custom Inventory was to show contents of Players backpack as part of the inventory output and I dont want to do this if that backpack isn't in same location as player. This time round I used an expression in restrictions: BackpackKey.Location = %Player%.Location. This worked fine when i added it into the main demo and would run fine, but when i exported Module and imported into a dummy demo and ran it the same error as mentioned before triggers again! If i delete that restriction it works fine.

Any idea how i can work around this? Currently backpack must be held or worn restrictions work fine, but im thinking of being able to know the contents if the backpack is on the ground where player is and they can see inside the bag etc.

*another update* :?

For some reason my latest import test failed again and without that restriction that caused it last time.

Only thing different in that Custom Inv task was another expression reference to the backpack in the output. It had a couple of others there before.
So i wonder why or what the issue is now?
User avatar
DazaKiwi
 
Posts: 524
Joined: Thu Oct 21, 2010 9:05 am
Location: New Zealand
Points: 16

Re: Module Import problem

Postby saabie » Fri Feb 16, 2018 12:02 am

I did notice that Inventory (Custom) has the same key as the standard library inventory task and is the only key in the file that does not have a daz prefix:
adrift Code: Select all
<Task>
        <Key>Inventory</Key>
        <Priority>12</Priority>
        <Type>Specific</Type>
        <GeneralTask>daz5Inventory</GeneralTask>
        <Description>Inventory (Custom)</Description>

Duplicate keys can cause all sorts of problems on import, either confusing the runner or causing one of the tasks to have its key changed.
There is also an "<Exclude>Inventory</Exclude>" entry at the end which is probably meant to delete the task from the standard library, but as this is at the end of the file the importer probably does it last so it does not prevent it getting confused by the duplicate key.

You might like to try making a copy of this task (in the original file) making sure it has a daz prefixed key, then deleting the bad task and re-exporting the folder.
saabie
 
Posts: 888
Joined: Fri Aug 12, 2011 2:07 am
Location: Adelaide, South Australia
Points: 10

Re: Module Import problem

Postby DazaKiwi » Fri Feb 16, 2018 12:28 am

Thanks saabie. I should of clicked onto this with the key not having my prefix.

Btw do i need to remove the line Exclude>Inventory</Exclude> from the module xml as well?

The problem returned but i discovered when importing the module the Custom Inventory (new one) would have setting override to nothing, so it was missing which task to override, once this was put back it worked fine. So why is that not holding to what it was set to? i have two other specific tasks in the module which are fine. The new custom inventory i made from scratch not a copy of previous one.

Note:
I did a test and changed the override to a different task and it held to that fine when i exported module and imported it. So i think perhaps this issue with specific/Inventory task could definitely be a bug?

I've changed it to a general task and give it a higher priority over the default inventory and everything is fine now.
User avatar
DazaKiwi
 
Posts: 524
Joined: Thu Oct 21, 2010 9:05 am
Location: New Zealand
Points: 16

Re: Module Import problem

Postby saabie » Fri Feb 16, 2018 1:37 am

DazaKiwi wrote:Btw do i need to remove the line <Exclude>Inventory</Exclude>
This line deletes the Inventory task from the standard library. Keep the line if you want to remove the standard inventory task, remove it if you want to keep the standard inventory task when someone imports your module.
The problem returned but i discovered when importing the module the Custom Inventory (new one) would set override to nothing, so it was missing which task to override, once this was put back it worked fine. So why is that not holding to what it was set to?
Because it still had the invalid key in that field and no task with that key exists so it was deleted.

If you repeatedly import different versions of the same module into the same game file then it can get permanently screwed-up, so when testing a module you should import it into a fresh copy of the test game each time.
saabie
 
Posts: 888
Joined: Fri Aug 12, 2011 2:07 am
Location: Adelaide, South Australia
Points: 10

Re: Module Import problem

Postby DazaKiwi » Fri Feb 16, 2018 2:40 am

saabie wrote:
DazaKiwi wrote:Btw do i need to remove the line <Exclude>Inventory</Exclude>
This line deletes the Inventory task from the standard library. Keep the line if you want to remove the standard inventory task, remove it if you want to keep the standard inventory task when someone imports your module.
The problem returned but i discovered when importing the module the Custom Inventory (new one) would set override to nothing, so it was missing which task to override, once this was put back it worked fine. So why is that not holding to what it was set to?
Because it still had the invalid key in that field and no task with that key exists so it was deleted.

If you repeatedly import different versions of the same module into the same game file then it can get permanently screwed-up, so when testing a module you should import it into a fresh copy of the test game each time.


Okay thanks saabie. So it wasn't a bug as per se, just troubled waters when you..as you say repeatedly import different versions of the same module. I shall be better informed next time. The main thing is, its all working now after some much further tests.
User avatar
DazaKiwi
 
Posts: 524
Joined: Thu Oct 21, 2010 9:05 am
Location: New Zealand
Points: 16


Return to ADRIFT 5.0

Who is online

Users browsing this forum: No registered users and 3 guests