Hello.
I get an error when I test a game, when it loads it up:
"script link failed: runtine error: unresolved import"
What does that mean, exactly? And how can I fix it?
Let me tell you what I'm doing. I'm working on the Mech Gladiators Tech Demo, and I want to use some code in a dialog that I can't.
Here's the code of the dialog (although I'm spoiling a bit of it):
// dialog script file
@S
returnÃ, // dialog startup entry point
@1
run-script 1
returnÃ, // option 1
@2
run-script 2
returnÃ, // option 2
@3Ã, // option 3
ego: "Alright, we're finished here."
officer: "Have a good day, sir, and remember:"
officer: "Stay legal."
return
@4Ã, // option 4
return
And here's my dialog_request:
function dialog_request(int parameter) {
if (parameter==1) // Pay a fine at a police station
Ã, {
Ã, Ã, if (GetGlobalInt(6)==0)
Ã, Ã, {
Ã, Ã, Ã, cOfficer.Say("Well, sir, it seems you don't have any criminal record at this time.");
Ã, Ã, }
Ã, Ã, if (GetGlobalInt(6)>0)
Ã, Ã, {
Ã, Ã, Ã, if (GetGlobalInt(6)>GetGlobalInt(1))
Ã, Ã, Ã, {
Ã, Ã, Ã, Ã, cOfficer.Say("Sir, it seems you don't have enough assets to pay your fine.");
Ã, Ã, Ã, Ã, cOfficer.Say("Quickly get some money, and pay your fine. But legally of course.");
Ã, Ã, Ã, Ã, cEgo.Say("Sure thing.");
Ã, Ã, Ã, }
Ã, Ã, Ã, if (GetGlobalInt(6)<=GetGlobalInt(1))
Ã, Ã, Ã, {
Ã, Ã, Ã, Ã, cOfficer.Say("Hand me your C-Card, sir.");
Ã, Ã, Ã, Ã, cEgo.Say("Here you go.");
Ã, Ã, Ã, Ã, cOfficer.Say("One minute mr. Flannighan.");
Ã, Ã, Ã, Ã, cOfficer.Say("Right, here's your card back. Thank you for being legal again.");
Ã, Ã, Ã, Ã, SetGlobalInt(1, GetGlobalInt(1)-GetGlobalInt(6));
Ã, Ã, Ã, Ã, }
Ã, Ã, Ã, }
Ã, }
Ã, if (parameter==2) // Get the mech license
Ã, {
Ã, Ã, if ((GetGlobalInt(4)<10) && (GetGlobalInt(5)<200))
Ã, Ã, {
Ã, Ã, Ã, cOfficer.Say("I'm sorry, sir, but you seem to not fit the criteria required to obtaining a mech piloting license.");
Ã, Ã, Ã, Display("You need 10 Intelligence points, and 200 Experience points to obtain a mech piloting license.");
Ã, Ã, }
Ã, Ã, if ((GetGlobalInt(4)>=10) && (GetGlobalInt(5)>=200))
Ã, Ã, {
Ã, Ã, Ã, cOfficer.Say("You seem to meet our criteria, so I see no problem.");
Ã, Ã, Ã, cOfficer.Say("Just hand me your ID Card, and I shall attach the license chip to it.");
Ã, Ã, Ã, cEgo.Say("Here you go.");
Ã, Ã, Ã, cOfficer.Say("And here YOU go. Happy mech piloting, mr. Flannighan.");
Ã, Ã, Ã, cEgo.Say("Thanks.");
Ã, Ã, Ã, cEgo.LoseInventory(iid1);
Ã, Ã, Ã, cEgo.AddInventory(iid2);
Ã, Ã, Ã, }
Ã, }
}
Please help quickly, my project depends on it.
Quote from: Dan_N_GameZ on Sat 03/02/2007 21:04:14I get an error when I test a game, when it loads it up:
"script link failed: runtine error: unresolved import"
The "unresolved import" error basically means you have a script code that references some variable or function that just doesn't exist.
A typical example would be if you put "import int myvariable;" into the script header but didn't export it from the main global script, and then try accessing that variable from within a room script.
But AGS then usually reports the name of that variable/function!
So first of all, what is the
exact text of error message you got (you can press Ctrl-C to copy it to the clipboard, then paste here) ?
Additionally, did it start happening after you had added that script into dialog_request?
What if you comment out "dialog_request", does it crash then?
It seems the problem lies in the dialog script, because I edited out everything in dialog_request, and also commented out the run-script x commands.
The exact text of the error is
Quotescript link failed: runtine error: unresolved import 'dTalkToPoliceOfficer'
(obviously dTalkToPoliceOfficer is the script name of my dialog topic)
Try shortening the dialog name - dTalkToPoliceOfficer gave me that error too, while dTalkToCop (with the exact same dialog code) worked fine. Perhaps there's a 'hidden' limit on how long they can be?
EDIT:
It seems you just crossed the limit - dTalkToPoliceOffice will also work OK. It looks like any dialog name longer than 18 letters will be cropped for the Script name. So, you might've called it 'TalkToPoliceOfficer', but the Script name would be dTalkToPoliceOffice - so you get the unresolved import error when you try to use the full version. Basically, it looks like a shorter name is the way to go.
Thanks, Ashen, that did it.
I had a feeling I'd be something really simple...
Well, looks like I can still prove your wrong :D.
Quote from: Ashen on Sun 04/02/2007 12:02:09It looks like any dialog name longer than 18 letters will be cropped for the Script name. So, you might've called it 'TalkToPoliceOfficer', but the Script name would be dTalkToPoliceOffice
Hmm... Indeed, seems like there is a bug in the Editor where you can input a string of 19 characters for the dialog name, and the Script Compiler will be feed with a corresponding 20 characters token ("d"+name), but the real dialog script name is internally truncated down to 19 characters causing names mismatching at linking stage:
Topic name in textbox: | TalkToPoliceOfficer (19 chars) |
Topic script name for compiler: | dTalkToPoliceOfficer (20 chars) |
Topic internal script name: | dTalkToPoliceOffice (19 chars) |
I guess the Editor is meant to allow 18 characters dialog names insteas of 19, as besides the orignal problem it also behaves strange where you enter 19 chars topic name, then enter some name for the topic below, click a list of names to cause update of names, and the second topic name gets added to the name of the previous one; and then clicking the previous topic truncates its name to 19 chars but also clears the name of the one below it.
A workaround, as Ashen found out, to
not enter dialog topic names longer than 18 characters (whereas the editor allows 19 chars).
Could please a moderator move this topic to the Technical Forum for CJ to take a look?
That seems to be a problem of the Editor, which is under total re-design at the moment, but nevertheless I think it's worth letting him know, just in case.
Interesting, I'll need to make sure this is taken account of in the new editor.