Announcement: Be excellent to each other.


Caravel Forum : DROD RPG Boards : RPG Bugs : Wierd Scripting: "Unexpected Accessory Type" and fatal error (Two different glitches caused by similar thing)
New Topic New Poll Post Reply
Poster Message
Kwakstur
Level: Smiter
Avatar
Rank Points: 385
Registered: 05-05-2006
IP: Logged

File: Misc Scripts Bug.drh (4.2 KB)
Downloaded 22 times.
License: Public Domain
icon Wierd Scripting: "Unexpected Accessory Type" and fatal error (+1)  
It's me again! With another long post that I just simply don't know how to shorten!

I'm making Prinnies, dood! Well, right now they just look like boxes with diagonal lines (I always make graphics last), but you can throw them and they explode.

Here's what's so interesting about how I coded them: The same NPC is an Accessory, a Weapon, and an enemy! Here's how it works:
Click here to view the secret text


The code is still vrey mssesy and scrabmabambled. After the first glitch, which was DROD closing (see second post), I made lots of random changes without much thought. The code's an indecipherable mess, the Accessory Prinny claims to be a Sprite, and I'm getting this error:
Assertion error in line 2006 of .\TileImageCalcs.cpp: "!"Unexpected accessory type.""
Which occurs every single turn after equipping the Prinny Weapon, and when you open and close the Dialogue Window.

The nest post is about another bug: One that causes DROD to close.

____________________________
Also known as ExpHP everywhere else.

[Last edited by Kwakstur at 12-08-2008 02:04 AM]
12-07-2008 at 10:41 PM
View Profile Send Private Message to User Send Email to User Visit Homepage Show all user's posts Quote Reply
Kwakstur
Level: Smiter
Avatar
Rank Points: 385
Registered: 05-05-2006
IP: Logged

File: Misc Scripts Bug 2.drh (4 KB)
Downloaded 24 times.
License: Public Domain
icon Re: Wierd Scripting: "Unexpected Accessory Type" and fatal error (+2)  
Ah, here we are. I took the old code that I put in "sto" and modified both it and (Throw Prinny).

Since there's no beeping and the equipment changes appear to be more accurate, this at first seems to run much better. Unfortunately, it isn't. Some odd things:
1. You have to use the Prinny Accessory twice to get the weapon and the Throw Accessory.
2. The Power does not increase when you wait/move.
3. If you don't use (Throw Prinny) just yet and instead use the Prinny Weapon, you get another! This only happens once.
4. If you then take a few steps and now try to use (Throw Prinny), DROD closes. No error, just a silent death.

#1-3 are most certainly scripting flaws on my part; this code is dated and one of my first drafts for the NPC. #4, on the other hand...

____________________________
Also known as ExpHP everywhere else.

[Last edited by Kwakstur at 12-08-2008 02:06 AM]
12-07-2008 at 11:16 PM
View Profile Send Private Message to User Send Email to User Visit Homepage Show all user's posts Quote Reply
mrimer
Level: Legendary Smitemaster
Avatar
Rank Points: 5056
Registered: 02-04-2003
IP: Logged
icon Re: Wierd Scripting: "Unexpected Accessory Type" and fatal error (+1)  
Kwakstur wrote:
4. If you then take a few steps and now try to use (Throw Prinny), DROD closes. No error, just a silent death.
Whoa, stack overflow. I see it creates an NPC that immediately creates another of itself, which creates another of itself, ad infinitum. Hmm...so I have to guard against that happening.

I've fixed this in build 55 by watching how long this NPC creation recursion goes on. I've set an arbitrary limit of three times. If it goes past that, you'll get an error logged and it won't execute the new NPC's script until next turn in order to avoid the overload. That stops the crash, but it won't fix your script.

____________________________
Gandalf? Yes... That's what they used to call me.
Gandalf the Grey. That was my name.
I am Gandalf the White.
And I come back to you now at the turn of the tide.

[Last edited by mrimer at 01-19-2009 11:42 PM]
01-19-2009 at 11:42 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
mrimer
Level: Legendary Smitemaster
Avatar
Rank Points: 5056
Registered: 02-04-2003
IP: Logged
icon Re: Wierd Scripting: "Unexpected Accessory Type" and fatal error (0)  
Kwakstur wrote:
The code's an indecipherable mess, the Accessory Prinny claims to be a Sprite, and I'm getting this error:
Assertion error in line 2006 of .\TileImageCalcs.cpp: "!"Unexpected accessory type.""
Which occurs every single turn after equipping the Prinny Weapon, and when you open and close the Dialogue Window.
Thanks for reporting this and providing a hold to reproduce the bug. It was pretty obscure, but I found and fixed it:

When using a script command to set your accessory to 20006, that accessory item calls "Equipment Destroy Accessory" as it's being set up. So you don't actually have an accessory at that point, but the game didn't check for that weird possibility, and set your accessory slot to 20006 after finishing its set up. So, when it tries to draw inventory item 20006, and you don't actually have one, you get the error.

I've fixed this by adding code to carefully check that after placing a custom item in an item slot, it actually is still in the slot. If no item is there, that fact is recorded correctly. If a standard item is there instead of the custom one originally specified, it's left as-is. If a *different* custom item is in the slot than the one originally specified (also a remote possibility), then that one will be marked as your current item instead of the value you originally gave in the script. (Phew!)

____________________________
Gandalf? Yes... That's what they used to call me.
Gandalf the Grey. That was my name.
I am Gandalf the White.
And I come back to you now at the turn of the tide.

[Last edited by mrimer at 01-20-2009 12:54 AM]
01-20-2009 at 12:53 AM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
New Topic New Poll Post Reply
Caravel Forum : DROD RPG Boards : RPG Bugs : Wierd Scripting: "Unexpected Accessory Type" and fatal error (Two different glitches caused by similar thing)
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.