Inventory just for spells?

Hi, so I want to make a separate inventory just for spells, something like the one in A Stranger, Unregarded.

http://textadventures.co.uk/games/play/vh_rnrkiqeshmt4zzmbmzg

The spells should function just like normal items, the only thing that's different is where they're stored. The separate inventory preferably should show up in the game panes but if not then it's ok.

Is this possible to make this on the web editor? Thanks


I think it should be.
Do you want spells to function exactly like normal items (so you can use "look at", "drop", "use" etc.)? Or do you want them to have different commands?

If they're the same, then really you only need to modify the javascript. You could give all your spells a "spell_" prefix on their listalias, and then send the client a modified copy of the updateList function that takes that prefix off again and puts them in a pane of their own. (I think updateList is the only one you actually need to override to add an extra set of verb buttons). You'd probably also want to override the inventory command, so that it lists spells separately from other items.

If they have their own commands and don't use "take", "drop", "look" etc, then you can create an inaccessible room somewhere to contain them. Maybe call it "spellbook". You could then make, for example, a command with the pattern "cast #object1# on #object2#" and give it the pattern "object1=spellbook|object2=all" so that it will work correctly. Adding a pane for the spellbook, you could either add a custom pane; or use a modified version of the method I mentioned in the previous paragraph, so that the spellbook pane has verb buttons that act like the ones in the regular inventory pane.

That's got me a bit interested now… I want to play with the JS code, but my own game doesn't give me any reason to do so. And with only 1 pre-order on a book that's due out tomorrow, I should probably take a break from game-making to focus on something that might actually help me keep a roof over my head.


Hi, Hopefully the attached link should help you out. Not done it myself though.
https://github.com/ThePix/quest/wiki/Library:-Second-inventory


You should be able to do it with the library Dr Agon linked to, but will take some fiddling to get it to work as you are using the desktop version.The tricking bit is adding an attribute that contains the HTML/JavaScript. There are recent threads that describe how to do, but it is not something I have done myself.


I'm actually using the web editor, so thats why I want to know if it's possible XD. I tried to follow the link Dr. Agon posted but I got hopelessly mixed up.... I know virtually nothing about the code. I also tried doing the first step but when I tested it out the game didn't load at all and instead showed an error message.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums