Cannot open game after adding a lib

Slent
16 Sept 2013, 16:16
Hello all

I hope you guys can help me with a small hickup I'm having. I'm pretty new to Quest and thought I would try to add a lib to the game I'm working on. I tried to download RPG elements made by Pertex and added it.

My problem comes when trying to open my game after I added combat.aslx. Apparently there was a function called equip, which was a function I already had. Now it just gives me an error saying I cannot open the game because they are conflicting. If I try to delete the combat.aslx file from the folder, I cannot open the game because it cannot find the combat.aslx file. This seems to make me unable to go into the game and deleting the lib.

Is my game really broken because of that, or can it be fixed somehow?

Hope you guys can help :)

Thanks!


viewtopic.php?f=18&t=2660

jaynabonne
16 Sept 2013, 17:10
You can edit the .aslx file for your game with a text editor and remove the <include> line with the combat lib. Then you can at least open your game again. :)

Slent
16 Sept 2013, 17:24
Thank you a bunch, that worked! Saved me for a lot of work :P

Are there any artifact I should be looking for? I never did anything but click add for that lib, but I'm not sure whether it has added hidden stuff around my game that I can't obviously see?

HegemonKhan
17 Sept 2013, 01:06
no, you should be good, so long as you save your game file after removing the, <include ref="name_of_library_file" /> , code line from your game file code.

Alex designed the quest engine so that it'll load up that library file's contents into your game, but not into the game file itself.

In fact, quest's "built-in" (core coding) is a library file itself:

<include ref="Core.aslx" />

and the default (english) language file:

<include ref="English.aslx" />

which you can, by the way, change to denmark language (I'm sure it's available, hopefully, lol).

can you spot the two default "built-in" library files in the new game coding below?

<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
</asl>


if you're a gamer, think of a library file as a "patch" or "xpac" or "mod" that is used along with your game file for creating and~or playing your game, and thus your game file itself remains unchanged, making it very easy to stop the library file's contents not being used anymore, by simply removing the code line that causes it to be used along with your game file's contents for creating or playing your game, should you not want to use the library file anymore.

----------

If your equip function isn't special (doesn't do anything extra), you can remove it, and then hopefully, Pertex' library will work.

---------

Do you know coding~programming? If you're just new to quest, but not to coding~programming, you should be able to learn it quickly, as it's really user~friendly. If you're new to coding~programming, quest is very noob~friendly in learning to use it's coding too. If interested, I can help you learn to work with quest's coding, as I was a total noob with coding, and have learned quite a lot after ~ a year, though I'm still no where near Jayna, Pertex, Sgreig, Pixie, Chase, Levicki, and etc (sorry if I left any of you off the list, lol).

HegemonKhan
17 Sept 2013, 02:56
small (but big) caveat:

if you created~added anything to your game with the library, and saved it, then that stuff that you created~added stays there, but the library's contents will be gone when you remove the library, however but, this is likely to cause an error, as what you created~added, usually requires the contents from the library for it to work.

Slent
17 Sept 2013, 07:12
Thank you for the detailed description khan!

Yeah I quickly spotted the core and english libs in the code, and also knew that they were the basics for quest as I've read through the tutorial on wiki. I like how customizable Quest is with these libraries which is also why I got surprised that I could simply not open my game after getting that conflict of functions, but I'm glad to see it's so easy to open with just a text editor and you can edit stuff there too.

I do know my way around code, although I am no hardcore programmer, and I have quickly learned a lot about Quest's way of doing it. You're right that it is very noobie friendly and I feel like I've learned a lot this past week I've worked with it. Although I have not yet learned enough of the code to comfortably work in the code view of Quest I have still made some pretty neat stuff via the Quest GUI. It will be quicker when I learn to work more from the code view though :D

As a way of learning Quest, I've decided to do as much as I can myself, meaning I would like to use as few libs from others as possible. Although these libs can certainly save me a lot of time, I like to learn by doing myself. This is also why I'm working on a very ambitious project but so far it is coming along nicely.

Thank you for offering to help! I appreciate the welcoming atmosphere! If, or rather when, I need some help I'll be sure to ask! :)

HegemonKhan
18 Sept 2013, 04:20
it's a bit time consuming, but you can do stuff in the GUI~Editor first, and then look at it in code view, seeing how it's done in code (and for me, the reverse, lol~hehe. Doing it in code, then switching to the GUI~Editor mode, to see how it's done via the GUI~Editor, lol).

if you don't yet know, besides just opening the file with notepad, wordpad, or notepad++ (highly recommend to download if you don't use it already, very useful for writing, editing, and troubleshooting code. From the top menu, when using notepad++ software, under the "language" menu choice, choose "XML" for the coding language), within the GUI~Editor, at the top is a bar, click on the notepaper like button (it's between the "play" and "?-help" buttons. This notepaper like button is a toggle button, for switching between the GUI~Editor mode and the Code View mode.

----------

the conflict is likely due to having two things with the same NAME attribute.

NAME attribute: this is used as the "ID" (identifier) for the game engine, so you can't have two things with the same Name Attribute.

ALIAS attribute: this is for us the players of the game during game play, it is what we see, it is the "name" of the thing for us. But, the ALIAS attribute is *NOT* used by the game engine to recognize~identify things, so you can have multiple things with the same ALIAS attribute.

In Code, for example:

to CREATE (Add) a Name Attribute to an Object and~or an attribute (and to create~add an object and~or Attribute too, if that is what you've choosen to code):

<object name="orc_boss_1">
</object>

OR, in this format (an old version but still useable format for attributes), the first word~string (orc_boss_1) is recognized as the NAME attribute:

<orc_boss_1 type="object">
</orc_boss_1>

<dead type="boolean">false</dead>

<strength type="int">50</strength>

<hit_points type="double">5005.9813</hit_points>

<race type="string">human</race>

<race_string_list type="simplestringlist">human; dwarf; elf; orc</race_string_list> // notice how I can't also call (NAME attribute) this as "race", using instead "race_string_list" as it's Name Attribute, due to already using "race" for my String Attribute's NAME attribute above, as it'll cause an error.

<game_over type="script"><![CDATA[
-> if (player.hit_points <= 0) {
->-> msg ("GAME OVER")
->-> finish
-> }
]]></game_over>

for Scripting (actions, USING the object_and_its_attribute or just a variable_string):

Global~Permanent: name_of_object.name_of_attribute=Value_or_Expression
example using a Value: HK.strength = 100
example using an Expression ("addr" = add'er = addition): HK.strength = HK.strength + 5
conceptually:
HK.strength = 0 (old~initial~starting value)
HK.strength (new value) = HK.strength (old value) + 5
HK.strength = 0 + 5
HK.strength = 5 (new value)

~OR~

Local~Temporary: name_of_variable_string=Value_or_Expression
Example: you_go_first_in_combat = true~false // or: yes~no, plus~minus, up~down (lol), black~blue (lol), etc etc etc (whatever strings you want to use, long as you use them properly)
example of using "exotic" strings ("black", "blue", and "yellow"):
show menu ("what color?", split ("black;blue;yellow", ";"), false) {
-> // quest engine does this automatically for you: result = what you selected
-> value_x = result
-> switch (value_x) {
->-> case ("black") {
->->-> msg ("1")
->-> }
->-> case ("blue") {
->->-> msg ("2")
->-> }
->-> case ("yellow") {
->->-> msg ("3")
->-> }
-> }
}

In GUI~Editor, for example:

"room" (default single Room Object) -> Objects (Tab) -> Add ->

Name (popup box, type it's name in here): orc_boss_1

"player" (default single Player Object) -> Attributes (Tab) -> Attributes -> Add ->

(you don't have these options~boxes for "Type" and "Value" in the online~web version; but you can use a roundabout way, by using the: Game -> Scripts Tab -> "Start" Script -> Add a~new script -> Variables -> Add a variable or attribute -> fill it in)

Attributes of the "player" (Player) Object's Attributes:

Attribute 1:
Name Attribute: strength
Type Attribute: int
Value Attribute: 100

Attribute 2:
Name: flying
Type: boolean
Value: false

Attribute 3:
Name: death
Type: script
Value (as an Expression): if (player.hit_points <= 0) { finish }

Attribute 4:
Name: bag_of_food
Type: objectlist
Value (as an Expression... or maybe not, not sure on this, meh, lol): bread; salted_pork; etc

so, if we have (I'll use the code form instead, as it's quicker to type out ~ why I like using code when trying to explain stuff):

// your object
<object name="orc">
</object>

// HK's Library's object
<object name="orc">
</object>

= ERROR!

// your script (verb)
<equip type="script">
</equip>

// HK's Library's script (verb)
<equip type="script">
</equip>

= ERROR!

---------------------------

// your object
<object name="orc_boss_1">
</object>

// HK's Library's object
<object name="orc_boss_2">
</object>

= NO error! = it WORKS!

// your object
<object name="orc_boss_1">
-> <alias type="string">orc</alias> // or, this simplified format~syntax: <alias>orc</alias>
-> <strength type="int">100</strength>
</object>

// HK's Library's object
<object name="orc_green_1">
-> <alias type="string">orc</alias> // or, this simplified format~syntax: <alias>orc</alias>
-> <strength type="int">25</strength>
</object>

// HK's Library's object
<object name="orc_dark_green_1">
-> <alias type="string">orc</alias> // or, this simplified format~syntax: <alias>orc</alias>
-> <strength type="int">50</strength>
</object>

// HK's Library's object
<object name="orc_shadow_1">
-> <alias type="string">orc</alias> // or, this simplified format~syntax: <alias>orc</alias>
-> <strength type="int">75</strength>
</object>

= NO error! = it WORKS!

Slent
18 Sept 2013, 07:30
Once again thank you for a very detailed answer Khan. Certainly stuff I can use :)

I did indeed suspect that it was a conflict between two IDs that caused the error. I was surprised though, that Quest simply refuses to open in such a case instead of just refusing to run/play the game.

It would be nice if Quest, instead of refusing to open the game, gave a notice about the error and then you had to fix it before you could run your game. As it is now it makes it hard to include a library after you've made a good bit of a game I suppose, as the more you have developed by yourself the higher the risk of a conflict with a lib?

HegemonKhan
19 Sept 2013, 01:37
yes, unfortunately, you have to possibly troubleshoot twice:

1. "critical" errors: just to get the game file to startup, ie "initialize", to the GUI~Editor window or game play window ~ though you can still edit~fix it, by opening it up in a text document software (notepad, wordpad, or notepad++).
2. "minor" bugs: errors during game play that persist (popup).

(troubleshooting is... fun... lol. If I can troubleshoot, I know I'm successfully learning to code, and~or am learning to code more and more, lol. I hate and love when it's a simple mistake causing the error, I'm relieved~love that it wasn't due to my inability to code ~ very bad if you can't even do the coding lol, but I hate how hard~long it took me to finally realize it is a simple error and~or to find that simple error... so hard to spot... lol. I notoriously have the bad habit of forgetting to do the ending tag, ">" or "/>" on things, grrr! I have other bad habits too... but let me not list all of them! Making lots of simple mistakes or typoes doesn't go well with code writing... heh)

(troubleshooting my combat code was a nightmare! but I did it, and wow did I feel good, hence my "veni vidi vici" outcry in my post, when I finally got my combat code to work~function! this was back some time ago, when my coding ability was much less)

Slent
19 Sept 2013, 06:38
It is indeed satisfying to find a small bug in your code which gets it to work. Although some of those bugs can take ages to find :D Like missing > or /> as you mention. I did a lot of bug fixing yesterday as I had a value from an object being added twice when picking it up. It turned out, after much work, that it had saved some code from a previously deleted verb on that object. Even though I had deleted the verb doing it, it had saved the code in the attributes window on that object. That was annoying, but boy was I glad when I found it and fixed it :D