Sorting algorithm is having problems

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

pixelizedgaming

New Member
Dec 25, 2019
9
0
0
22
kinda new to skripting, so i suck

anyways im trying to make a least to greatest sorting algorithm

Code:
function least2greatest(list: objects) :: objects: #list has entries modeled like %number%.%text%
 set {_i} to 0
 loop size of {_list::*} times:
  add 1 to {_i}
  set {_j} to {_i}
  loop size of {_list::*} times:
   add 1 to {_j}
   if {_j} is less than size of {_list::*} + 1:
   set {_one} to 1
   set {_tt1::*} to {_list::%{_i}%} split at "."
   set {_t1} to {tt1::%{_one}%} parsed as an integer
   set {_tt2::*} to {_list::%{_j}%} split at "."
   set {_t2} to {tt2::%{_one}%} parsed as an integer
   broadcast "%{_tt1::*}%, %{_tt2::*}%" #each of them show up as "%number% and %text%", so it works
   broadcast "%{_list::%{_i}%}%,%{_list::%{_j}%}%" #each of them show up as "%number%.%text%" so it works
   broadcast "%{_t1}%,%{_t2}%" # both show up as <none>
   if {_t1} is greater than {_t2}:
    set {_temp} to {_list::%{_i}%}
    set {_list::%{_i}%} to {_list::%{_j}%}
    set {_list::%{_j}%} to {_temp}
  
  
   else:
   stop
 broadcast "%{_list::*}%"

why is {_t1} or {_t2} <none>
 
Status
Not open for further replies.