Arranging Functions

Heya all,

Is there any way to rearrange functions in the Quest UI? It really grinds me sometimes how I can't group my functions to a particular area. Even more annoying, I seem to have found Quest goes nuts if I try and rename a function after it's already connected to things, throwing up errors and making the UI seem to hate me, so renaming all my functions to be used in a particular method that allows them to be searched easier for is proving a pain.


This has come up before, in general with quest re-arranging/re-sorting your Elements (Functions, Objects, etc), and I don't think Pixie has found out where this is done within quest's underlying code.


unfortunately, the naming/labeling can't be helped... aside from knowing/creating a great system immediately already, that you never need to go back and re-name/re-label stuff (I've had to re-name/re-label stuff many times myself, very NOT fun, indeed, lol). And this only comes from practice/experience/trial-n-error. Eventually, you start developing a better and better naming/labeling convention/system/scheme, but it takes time and practice, slowly getting experience as to how to do the naming/labeling better.

I myself still haven't got a good naming/labeling system either, I'm still having to go back and re-name/re-label stuff, sighs.

and ya, if you change the name of something, you got to find EVERYWHERE in your code, and change all of the instances of it, from the old name to the new name, as again, the 'name' is the ID for quest, just as DNA is the ID for life. If I survived radiation mutating my cells/DNA, all uses of my DNA would be useless until updated to my new DNA, such as finger prints, DNA forensics, medical records, blood type, allergies, medicine/drugs, nutrition/diet/health, etc etc etc.


if you want to take the time, if you learn how Delegates work, you can use Objects and their Script Attributes, which is great for organization and structure/design and application, instead of using Functions.


or, a more simple solution is to work directly in code, as then you can write your Functions where you want them, as well as do other documentary stuff too (like section comments and etc), for an example with a library file of how I like to organize it (if I were just using a single library file ---- I now use multiple library files):

(I can't include every thing that I do though in it, but you should get the idea, and you of course can add the stuff you want in it)

(this would NOT be a library file that is sued by the game file, rather it's just a resource file, for you to copy and paste what you want/need from it into your game file or other library files)

<library>

  <!--
  Templates:
  -->

  <!--
  Dynamic Templates
  -->

  // blah dynamic templates

  <!--
  Verb Templates
  -->

  // blah Verb Templates

  <!--
  Verbs
  -->

  // blah verbs

  <!--
  Commands
  -->

  // blah commands

  <!--
  Functions
  -->

  // blah functions

  <!--
  Turnscripts
  -->

  // blah turnscripts

  <!--
  Timers
  -->

  // blah timers

  <!--
  Object Types / Types
  -->

  // blah Object Types / Types

  <!--
  Objects
  -->

  <!--
  Player Objects
  -->

  // blah player objects

  <!--
  Room Objects
  -->

  // blah room objects
 
  <!--
  Other Objects (non-room, non-player)
  -->

  <!--
  NPC Objects
  -->

  // blah npc objects

  <!--
  Equipment Objects
  -->

  // blah equipment objects

  <!--
  Spell Objects
  -->

  // blah spell objects

   <!--
  Item Objects
  -->

  // blah item objects
  
  <!--
  Attributes
  -->

  <!--
  Boolean Attributes
  -->

  // blah boolean attributes

  <!--
  Integer Attributes
  -->

  // blah integer attributes

  <!--
  Double Attributes
  -->

  // blah double attributes

  <!--
  String Attributes
  -->

  // blah string attributes

  <!--
  Object (reference/pointer) Attributes
  -->

  // blah object (reference/pointer) attributes

  <!--
 List Attributes
  -->

  <!--
 String List Attributes
  -->

  // blah string list attributes

  <!--
 Object List Attributes
  -->

  // blah object list attributes

  <!--
  Dictionary Attributes
  -->

  <!--
 String Dictionary Attributes
  -->

  // blah string dictionary attributes

 <!--
 Object Dictionary Attributes
  -->

  // blah object dictionary attributes

  <!--
 Script Dictionary Attributes
  -->

  // blah script dictionary attributes

  <!--
  Worlds
  -->

  <!--
  World 1
  -->

  // blah content/stuff/Elements/Objects/etc

<!--
  World 2
  -->

  // blah content/stuff/Elements/Objects/etc

  <!--
  Combat System
  -->

  <!--
  Magic System
  -->

  <!--
  Item System
  -->

  <!--
  Equipment system
  -->

  <!--
  Storage System
  -->

  <!--
  Diplomacy (Dialogue/Conversation/Topic) System
  -->

  <!--
  Stealth System
  -->

  <!--
  Transaction System (bartering/shopping)
  -->

  <!--
  Game Mechanics/Equations/Formulas
  -->

  <!--
  Additional Notes
  -->

</library>

Also....

you can always use the software's 'find' feature too, as almost all such software has the 'find' feature in it, for finding stuff in your code or essay or whatever, lol


where/when you can, try to use 'this' in your scripting, as this way if you change the parent Object's name, you don't need to worry about changing the scripting, as 'this' GETS whatever is the parent Object of the scripting, for example:

<object name="joe">
  <attr name="talk" type="script">
    msg ("Hi, my name is " + this.name)
  </attr>
</object>

and if I were to change the name:

<object name="john">
  <attr name="talk" type="script">
    msg ("Hi, my name is " + this.name)
  </attr>
</object>

// NO error! it (the scripting) still works! And I didn't have to change the 'this.name', either!

// (this might not seem like a big deal, but take this and scale it up to a huge game with lots of Objects and lots of scripting and lots of uses of those Objects and their Attributes in other scriptings (Functions, Commands, etc) all over your gam, and now it is a big deal!)

// ----------------

whereas... (YUCK!)....

<object name="joe">
  <attr name="talk" type="script">
    msg ("Hi, my name is " + joe.name)
  </attr>
</object>

and if I were to change the name:

<object name="john">
  <attr name="talk" type="script">
    msg ("Hi, my name is " + joe.name)
  </attr>
</object>

// ERROR, as I didn't change all the uses of 'joe' to 'john'

fixed up so NO error:

<object name="john">
  <attr name="talk" type="script">
    msg ("Hi, my name is " + john.name)
  </attr>
</object>

// but as you scale this up... it's a real pain to have to change the uses of the names... so use 'this' where/when you can in scripting.

Just copy and paste the functions in full code view. Then delete the copied code so there is no duplication. Just make sure the nesting (indentation) is exact when you paste the moved code. E.g., if you move a function's code, make sure when you paste it that its indentation is flush with the adjacent functions' indentations. If not, the game won't even load and you have to undo the paste.


I have been working directly on code from my 2nd day using Quest and split out into multiple library files and primarily the bulk of my game is in functions, I don't have issues with indentation causing errors, just if I forget that the opening { has to stay on the same line as the function like IF (A =B) {. It doesn't like it if you separate then.


Log in to post a reply.

Support

Forums