string list.contains()
Mmaarten
09 Apr 2020, 17:05is there a way to use a .contains(String) function on a string list attached to an attribute?
mrangel
10 Apr 2020, 01:08You want the ListContains (list, item)
function.
For example:
if (ListContains (object.displayverbs, "Drop")) {
(I used displayverbs for the example just because it's the most commonly used stringlist attribute)
Mmaarten
10 Apr 2020, 08:45Thanks! Is there a reference guide with all built in functions? I keep bumping into basic stuff like this that I could esily solve in any "real" language :P
Mmaarten
10 Apr 2020, 12:36That is the best answer I have ever seen <3
hegemonkhan
12 Apr 2020, 17:52(filler for getting my edited post, updated/posted)
more useful links (well, pages, as its the same doc site, lol):
https://docs.textadventures.co.uk/quest (main doc site page)
https://docs.textadventures.co.uk/quest/#Tutorial (quest tutorial)
https://docs.textadventures.co.uk/quest/aslx.html (aslx file format syntax)
https://docs.textadventures.co.uk/quest/scripts/setting_variables.html (VARIABLE syntax in-code for quest)
https://docs.textadventures.co.uk/quest/asl_requirements.html (the quest engine's required stuff)
https://docs.textadventures.co.uk/quest/using_libraries.html (library file usage)
https://docs.textadventures.co.uk/quest/elements/ (ELEMENTS: these are the OBJECTS of its Object-Oriented Programming, at least at the user-level, anyways. Do NOT confuse the ELEMENTS with the in-game/sub 'Object' ELEMENT)
https://docs.textadventures.co.uk/quest/types/ (Data Types)
https://docs.textadventures.co.uk/quest/null.html (the 'null' Data Type info)
https://docs.textadventures.co.uk/quest/elements/game.html (the special and required 'game' Object: publishing info, game-wide settings/controls, the special 'start' script, and etc other special stuff)
https://docs.textadventures.co.uk/quest/elements/object.html (all the built-in Attributes of the 'Object' ELEMENT, including at the very bottom, the built-in: Object Types / Types / Inherited Attributes / Groups-Classes, for in-game/user-level usage, anyways)
https://docs.textadventures.co.uk/quest/using_inherited_types.html (Object Types / Types / Inherited Attributes / Groups-Classes, for in-game/user-level usage, anyways)
https://docs.textadventures.co.uk/quest/scripts/ (the built-in Script/Functions)
https://docs.textadventures.co.uk/quest/functions/ (the built-in Functions, categorical order)
https://docs.textadventures.co.uk/quest/functions/index_allfunctions.html (the built-in Functions, alphabetical order)
https://docs.textadventures.co.uk/quest/using_lists.html (using list/arrays)
https://docs.textadventures.co.uk/quest/using_dictionaries.html (using dictionaries)
https://docs.textadventures.co.uk/quest/display_verbs.html (using displayverbs/inventoryverbs)
https://docs.textadventures.co.uk/quest/character_creation.html (character creation guide: getting user input, using lists/arrays, showing menus, using attributes, etc)
https://docs.textadventures.co.uk/quest/functions/#scope (scope/list-returning functions)
https://docs.textadventures.co.uk/quest/functions/#string (string manipulation functions)
quest has only two ways of getting typed-in inputs during game play:
- the 'get input' Script/Function ( https://docs.textadventures.co.uk/quest/scripts/get_input.html )
- the 'Command' ELEMENT ( https://docs.textadventures.co.uk/quest/elements/command.html )
you can also use menus (user selection from choices/options):
important:
capitolized menu functions are done as in-text menus (as clickable blue hyperlinks in the big text box on the left side)
VS
non-capitolized menu functions are done as a popup window menu
-
the 'show menu / ShowMenu' Functions ( https://docs.textadventures.co.uk/quest/scripts/show_menu.html and https://docs.textadventures.co.uk/quest/functions/showmenu.html)
-
the 'ask / Ask' (yes:true/no:false) menu function ( https://docs.textadventures.co.uk/quest/scripts/ask.html )
and there's probably a few more menu functions that I'm forgetting... meh
there's also lots of guides on the doc site as well as on pixie's quest github page/s too, and there's some tutorial/teaching games made by some people (XanMag and maybe some others), and also some utube tutorial/teaching videos as well by some people (forgot who/name, argh, my apologies)
for looping:
- the 'for' Function ( https://docs.textadventures.co.uk/quest/scripts/for.html )
- the 'foreach' Function ( https://docs.textadventures.co.uk/quest/scripts/foreach.html )
- the 'while' Function ( https://docs.textadventures.co.uk/quest/scripts/while.html )
- script call-back / "tail-end recursion" (the 'do' and 'invoke' Functions, or just using, if using a function, the function's name and parameters in-code directly)
there's no 'do-while' Function in quest (as far as I know)
very useful functions:
-
the 'GetXXX' functions (checking if Object has the specified Attribute and value, returns value or false)
-
the 'HasXXX' and the 'DoesInherit' functions (checking if Object has the specified Attribute, returns true/false)
-
the 'AllXXX'functions (returns Object Lists/Arrays)
-
the 'IsXXX' and the 'TypeOf' functions (checking Data Type functions, returns true/false)
-
the 'ToXXX' functions (Data Type conversion functions)
-
the 'Contains', 'Got', 'GetObject', and 'HasObject' functions (for Objects)
-
the 'ListContains' and 'DictionaryContains' functions (for Lists/Dictionaries)