ADRIFT Forum


The place to discuss the ADRIFT Interactive Fiction toolkit

Expression error that doesnt make sense to me

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.

Expression error that doesnt make sense to me

Postby DazaKiwi » Wed May 01, 2019 12:46 am

I'm making a demo as part of my Sub Commander game where i want to be able to order an ai unit to a new location and it automatically goes there on axis kind of travel and that part works, when i added some tasks to check adjacent location in all directions per movement its giving me a couple of bad expression errors; AiOne.Location.LocationTo(South).Characters.Characteri.Count > 0

I cannot work out what is going on. At one point i even deleted the task "Has Boat Spotted Sub Adjacent? - South Of" and then the error started to appear for the East one (which it didnt before or the others). At one point i tried to remove that "..South of" task (i mentioned) from 2 tasks that calls it- then the runner was then throwing multiple errors for 'object not set to reference of object' and then the expression errors etc. I had to reload a backup to stop that.

Im sure the expression is fine and have used that kind of expression before, i am using sort of a loop system (not official method) for the character/Ai boat to make its way to the correct Location. I could just have it teleport there so to speak- but i wanted the boat to be able to try and detected a sub (on surface). In my main game project i got that working for when manually moving 1 or 2 locations at a time- but this method is is sort of like auto travel.

Any ideas what is happening?
Attachments
Boat_Nav_Ai_demo_v1_test.taf
(18.84 KiB) Downloaded 15 times
User avatar
DazaKiwi
 
Posts: 627
Joined: Thu Oct 21, 2010 9:05 am
Location: New Zealand
Points: 16

Re: Expression error that doesnt make sense to me

Postby DazaKiwi » Wed May 01, 2019 9:35 pm

Further tests, using the same expression but with Player instead of character it doesnt throw any errors. So even though character is getting param correctly its doing something weird. So i thought of a work around- where i will move an object to a direction move character there and then run a check if it sees a sub before moving back to where it was and continue moving along the axis path to destination. When i ran this i got immediately an error "ReplaceFunctions error: Object reference not set to instance of an object" this will repeat for about 10 times or so before stopping and i can play my demo. I tired loading previous builds right back to v1 and it does this to all of them. I cannot think why it would do this, because the early build didn't do this.

Further more i can restart the demo in runner and those initial replacefunction errors do not popup again. So i somehow i think ive triggered with this demo some internal bug. I might have to start from scratch again and this time try my work around, in theory i think my first method should of worked as the expression works, but perhaps how i structured everything caused this issue?
Attachments
Boat_Nav_Ai_demo_v1_workaround.taf
This version will give 9 replace functions errors as mentioned in post. But will work after that.
(18.88 KiB) Downloaded 10 times
User avatar
DazaKiwi
 
Posts: 627
Joined: Thu Oct 21, 2010 9:05 am
Location: New Zealand
Points: 16

Re: Expression error that doesnt make sense to me

Postby DazaKiwi » Fri May 03, 2019 7:00 am

After trying to get this to work, i conclude there was nothing wrong with the expression but perhaps how i was putting everything together that caused the weird error which seemed to corrupt the file and even trying to remove some tasks it still was borked.

I managed to download my earlier version from here that was ok to use, and restructured things differently and didn't get any errors. However my method was flawed as i was getting 2 false positives where the sub wasn't present. So in the end i went with just checking each new location the character/boat moves to on its way to the destination and then check in all directions when arrived at destination.

So was glad i didn't have to start from scratch. Backups are paramount.
User avatar
DazaKiwi
 
Posts: 627
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 2 guests