sorting code designs

(filler for getting my edited post, updated/posted)
(again, filler for getting my edited post, updated/posted)
(again, filler for getting my edited post, updated/posted)


so, far I have just done a 'reverse' sort code, but I'll work on getting more types of sorting codes done and posted here

also, others are free/welcome to post their own sorting codes too !!!


here's an example game code for you (I'm not using Pixie's newest version, so let me know if this doesn't work for you):

(the code works, I actually tested it -- I made a lot of stupid mistakes -- took awhile to debug it -- lol, at least with my version of quest... however I manually typed in the code into this post... so... fingers-crossed... HK hopes there's no typos... lol)


output:

hegemonkhan

nahknomegeh

1. hegemon
2. khan
3. 1
4. 2
5. 3
6. 4
7. 5

1. 5
2. 4
3. 3
4. 2
5. 1
6. khan
7. hegemon

<asl version="550">

  <include ref="English.aslx" />
  <include ref="Core.aslx" />

  <delegate name="sort_delegate" parameters="input_parameter" type="string">

  <game name="example_game">

    <gameid>47a2dda3-b3d0-446e-b596-c13144519130</gameid>
    <version>1.0</version>
    <firstpublished>2018</firstpublished>

    <attr name="start" type="script">

      do (example_object, "example_script_attribute")

    </attr>

  </game>

  <object name="room">

    <inherit name="editor_room" />

    <object name="player">

      <inherit name="editor_object" />
      <inherit name="editor_player" />

    </object>

  </object>

  <object name="example_object">

    <inherit name="editor_object" />

    <attr name="example_string_attribute" type="string">hegemonkhan</attr>

    <example_stringlist_attribute type="stringlist">

      <value>hegemon</value>
      <value>khan</value>

      <value>1</value>
      <value>2</value>
      <value>3</value>
      <value>4</value>
      <value>5</value>

    </example_stringlist_attribute>

    <attr name="example_script_attribute" type="script">

      msg (example_object.example_string_attribute)

      msg ("")

      example_object.example_reverse_string_attribute = RunDelegateFunction (sort_object, "sort_reverse_script_attribute", example_object.example_string_attribute)

      msg (example_object.example_reverse_string_attribute)

      DisplayList (example_object.example_stringlist_attribute, true)

      reverse_string_variable = RunDelegateFunction (sort_object, "sort_reverse_script_attribute", example_object.example_stringlist_attribute)

      example_object.example_reverse_stringlist_attribute = split (reverse_string_variable, ";")

      DisplayList (example_object.example_reverse_stringlist_attribute, true)

    </attr>

  </object>

  <object name="sort_object">

    <inherit name="editor_object" />

    <attr name="sort_reverse_script_attribute" type="sort_delegate">

      concatenation_variable = ""

      if (TypeOf (input_parameter) = "string") {
        for (iterator_variable, 1, LengthOf (input_parameter)) {
          concatenation_variable = Mid (input_parameter, iterator_variable, 1) + concatenation_variable
        }
      }
      else if (TypeOf (input_parameter) = "stringlist") {
        foreach (item_variable, input_parameter) {
          concatenation_variable = ";" + item_variable + concatenation_variable
        }
        on ready {
          concatenation_variable = Mid (concatenation_variable, 2)
        }
      }
      else {
        return ("ERROR: wrong input type for the 'RunDeleteFunction' Script's/Function's last argument/parameter")
      }
      on ready {
        return (concatenation_variable)
      }

    </attr>

  </object>

</asl>

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

Support

Forums