textadventures / quest

Create text adventure games
http://textadventures.co.uk/quest
MIT License
304 stars 69 forks source link

Oh jeez. Image problem #969

Closed text22 closed 6 years ago

text22 commented 6 years ago

I have been working on a game called (Mario) The Music Box (GameBook Edition) and now it wont let me edit it. When i open it The Screen is grey and it says ,"System.NotSupportedException: No imaging component suitable to complete this operation was found. ---> System.Runtime.InteropServices.COMException: The component cannot be found. (Exception from HRESULT: 0x88982F50) --- End of inner exception stack trace --- at System.Windows.Media.Imaging.BitmapDecoder.SetupDecoderFromUriOrStream(Uri uri, Stream stream, BitmapCacheOption cacheOption, Guid& clsId, Boolean& isOriginalWritable, Stream& uriStream, UnmanagedMemoryStream& unmanagedMemoryStream, SafeFileHandle& safeFilehandle) at System.Windows.Media.Imaging.BitmapDecoder.CreateFromUriOrStream(Uri baseUri, Uri uri, Stream stream, BitmapCreateOptions createOptions, BitmapCacheOption cacheOption, RequestCachePolicy uriCachePolicy, Boolean insertInDecoderCache) at System.Windows.Media.Imaging.BitmapImage.FinalizeCreation() at System.Windows.Media.Imaging.BitmapImage.EndInit() at TextAdventures.Quest.EditorControls.FileDropDown.RefreshFileList() at TextAdventures.Quest.EditorControls.FileControl.Populate(IEditorData data) at TextAdventures.Quest.EditorControls.ElementEditor.Populate(IEditorData data) at TextAdventures.Quest.WPFElementEditor.Populate(IEditorData data) at TextAdventures.Quest.Editor.ShowEditor(String key) at TextAdventures.Quest.Editor.ctlTree_SelectionChanged(String key) at TextAdventures.Quest.EditorControls.WFEditorTree.ChangeSelection(String key) at TextAdventures.Quest.EditorControls.WFEditorTree.SelectCurrentTreeViewItem() at TextAdventures.Quest.EditorControls.WFEditorTree.ctlTreeView_AfterSelect(Object sender, TreeViewEventArgs e) at System.Windows.Forms.TreeView.OnAfterSelect(TreeViewEventArgs e) at System.Windows.Forms.TreeView.TvnSelected(NMTREEVIEW* nmtv) at System.Windows.Forms.TreeView.WmNotify(Message& m) at System.Windows.Forms.TreeView.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)" I am so confused. Before it all started i was trying to drag a image into my quest. I will send you the quest project and the image so you can fix it. I've been working hard on the project. HELP!!!

KVonGit commented 6 years ago

Hello.

Sorry to hear you're having troubles.

If you post a link to the files you have in your game's folder, I will see what I can do.


Note that I am just a Quest user. So I can't make any promises, but I will try my best to help out.

It actually sounds more like a user settings issue than a problem with the code to me, but I may something. You never know.


I do have one question:

Do other games work?

text22 commented 6 years ago

YES, All of my other games work. here is the file: Problem.zip

KVonGit commented 6 years ago

I'm investigating this right now.

Which Windows are you running, and which version of Quest?

KVonGit commented 6 years ago

It's something with Quest's latest beta.

It opens and runs for me with quest580beta1, but that is no longer listed, so I advise dropping back to 5.7.2 for now. The added features shouldn't allow you to do anything extra in a gamebook, anyway.

Sorry about that. I'm trying to find what change causes this. If I can't, Pixie probably can.

Here's a link to Quest 5.7.2:

https://github.com/textadventures/quest/releases/tag/5.7.2

KVonGit commented 6 years ago

Found a link to 5.8.0beta1, which loads your game for me:

https://github.com/textadventures/quest/releases/download/5.8.0-beta.1/quest580beta1.exe

Let me know if this works (or doesn't work), please.

KVonGit commented 6 years ago

In Quest 5\Core\Languages\EditorEnglish.aslx

These lines of code (at the beginning) are preventing the editor from opening a gamebook (but not a text adventure):

EDITED

  <dynamictemplate name="DevModeErrorCantFindObject">"The object with the name '" + text + "' cannot be found."</dynamictemplate>
  <dynamictemplate name="DevModeErrorCantFindAttribute">"The attribute with the name '" + text + "' cannot be found."</dynamictemplate>
KVonGit commented 6 years ago

Removed misinformation.

KVonGit commented 6 years ago

UPDATE

I uninstalled 580beta2. I downloaded it again. I installed that, and gamebooks work.


So, I decided to delete quest\ from my hard drive and clone it again as if it were new, to see if that solved the same issue with the current build.

When I build what's currently in the repo, the gamebooks will not open in the editor. So, just because I don't trust myself, I removed all of the code from my recent commits, but that didn't fix it. EDIT So, I added all my stuff back in.


Next, I deleted the DevMode templates from English.aslx (again; this is a newly cloned repo), and the gamebook opened in the editor again, just like before

...but there is another problem. This is what a new gamebook with nothing added prints when I press 'Play':

This is page 1. Type a description here, and then create links to other pages below.

Error running script: Cannot foreach over '' as it is not a list
Error running script: Error compiling expression 'Instr(text, "{")': FunctionCallElement: Could find not function 'Instr(Object, String)'

Error running script: Cannot foreach over '' as it is not a list
Error running script: Error compiling expression 'Instr(text, "{")': FunctionCallElement: Could find not function 'Instr(Object, String)'
KVonGit commented 6 years ago

UPDATE (found the fix)

The file GamebookCore.aslx has its own defaultgame object.

I added the new text processor game attributes to it, and the gamebook is functional.

```xml game.textprocessorcommandresult = ProcessTextCommand_If (section, data) game.textprocessorcommandresult = ProcessTextCommand_Either (section, data) game.textprocessorcommandresult = ProcessTextCommand_Here (section, data) game.textprocessorcommandresult = ProcessTextCommand_Here (section, data) game.textprocessorcommandresult = ProcessTextCommand_Popup (section, data) game.textprocessorcommandresult = ProcessTextCommand_Format (section, data) game.textprocessorcommandresult = ProcessTextCommand_Format (section, data) game.textprocessorcommandresult = ProcessTextCommand_Format (section, data) game.textprocessorcommandresult = ProcessTextCommand_Format (section, data) game.textprocessorcommandresult = ProcessTextCommand_Colour (section, data) game.textprocessorcommandresult = ProcessTextCommand_Colour (section, data) game.textprocessorcommandresult = ProcessTextCommand_Colour (section, data) game.textprocessorcommandresult = ProcessTextCommand_Object (section, data) game.textprocessorcommandresult = ProcessTextCommand_Command (section, data) game.textprocessorcommandresult = ProcessTextCommand_Command (section, data) game.textprocessorcommandresult = ProcessTextCommand_Exit (section, data) game.textprocessorcommandresult = ProcessTextCommand_Once (section, data) game.textprocessorcommandresult = ProcessTextCommand_NotFirst (section, data) game.textprocessorcommandresult = ProcessTextCommand_Random (section, data) game.textprocessorcommandresult = ProcessTextCommand_RandomAlias (section, data) game.textprocessorcommandresult = ProcessTextCommand_Img (section, data) game.textprocessorcommandresult = ProcessTextCommand_Counter (section, data) game.textprocessorcommandresult = ProcessTextCommand_Select (section, data) game.textprocessorcommandresult = ProcessTextCommand_Eval (section, data) game.textprocessorcommandresult = ProcessTextCommand_Eval (section, data) ```

I had to...

1. Remove the DevMode templates from EditorEnglish.aslx (I also removed DevMode.aslx from the includes in Core.aslx, but I don't know if this step is necessary.)

2. Add the text processor attribute to defaultgame in GamebookCore.aslx.

KVonGit commented 6 years ago

These two dynamic templates are the problem.

  <dynamictemplate name="DevModeErrorCantFindObject">"The object with the name '" + text + "' cannot be found."</dynamictemplate>
  <dynamictemplate name="DevModeErrorCantFindAttribute">"The attribute with the name '" + text + "' cannot be found."</dynamictemplate>
8ne commented 6 years ago

I could also make normal templates out of it. This is not so important if you are dynamic. Wouldn't that be a better solution? Or isn't it the only problem?

P.S.: I think discussing it here is more appropriate. I've been looking in here more often now. Promised. ^^

KVonGit commented 6 years ago

I moved the DevMode command templates to English.aslx. (I guess the editor can't handle dynamic templates in gamebook mode?)

Anyway, everything runs smoothly this way, and the two pull requests have been submitted.


The first thing I did was change them to normal templates, but once I found I could simply move the command stuff to English.aslx (which is where I think it belongs anyway), everything worked out perfectly.

KVonGit commented 6 years ago

I've been looking in here more often now.

I am "Watching" this repository, so I get an email each time something happens (including Issues, Pull Requests, and commits). It seems easier than remembering to check in.

KVonGit commented 6 years ago

@SoonGames

It's your code, so don't let me do something you don't like with it. I was just finding a good, clean, quick fix.

If you'd like to handle it differently, I can delete my pull requests and defer to you.

8ne commented 6 years ago

It's your code, so don't let me do something you don't like with it. I was just finding a good, clean, quick fix. If you'd like to handle it differently, I can delete my pull requests and defer to you.

No. That's all right. As long as it works. ;-) I was just desperately looking for a way to quote. ^^

8ne commented 6 years ago

That's right. You could move all commands to be executed in the command field (i.e. all templates from DevMode without "Editor" in front of it) to English.aslx or Deutsch.aslx.

8ne commented 6 years ago

Oh, yeah. You did. Perfect.

8ne commented 6 years ago

The German.aslx or EditorGerman.aslx would have to be changed accordingly. Are you gonna do this or can I do it fast?

KVonGit commented 6 years ago

The German.aslx or EditorGerman.aslx would have to be changed accordingly. Are you gonna do this or can I do it fast?

You better do it. (I wish I could sprechen sie Deutsch!)


PS

I also added a template called EditorGameEnableDevMode to EditorEnglish for a checkbox in the game's features which enables DevMode.

If this is not checked, the DevMode tab will be hidden.

See pull requests:

https://github.com/textadventures/quest/pull/975

https://github.com/textadventures/quest/pull/976

https://github.com/textadventures/quest/pull/977

8ne commented 6 years ago

I also added a template called EditorGameEnableDevMode to EditorEnglish for a checkbox in the game's features which enables DevMode.

Yeah, that's all right.

text22 commented 6 years ago

Can you send me the file you fixed?

KVonGit commented 6 years ago

I changed a few different files, and they are all sort of in GitHub limbo at the moment.

ThePix will either merge them or apply his own (better and more efficient) fix soon.


I uninstalled Quest, downloaded the quest580beta2 installer again, installed that, and everything worked fine.

If that doesn't work for you, and you want to run the beta version, I'd try to download and install quest580beta1:

https://github.com/textadventures/quest/releases/download/5.8.0-beta.1/quest580beta1.exe

...or, to be safe, you could just run the current release:

https://github.com/textadventures/quest/releases/download/5.7.2/quest572.exe


You are running Quest 580beta2, correct?

That was the only version of Quest I had problems opening your game with at first, but I did not have the image files, so Quest ignored them once I got Quest running. So, there still could be an issue with an image you're using, and I just happened to find a different bug while investigating your problem.

ThePix commented 6 years ago

I have merged the push requests, and it works for me now. I will put up a new beta in a couple of days.

text22 commented 6 years ago

THANKS!!!