deckShuffle.qsrc 749 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # deckShuffle
  2. if $ARGS[0] = 'sort':
  3. killvar 'deckFace'
  4. killvar '$deckImg'
  5. i = 0
  6. :loop1
  7. if i < 4:
  8. i += 1
  9. if i = 1:
  10. $text = 'Spades'
  11. elseif i = 2:
  12. $text = 'Hearts'
  13. elseif i = 3:
  14. $text = 'Clubs'
  15. elseif i = 4:
  16. $text = 'Diamonds'
  17. end
  18. j = 0
  19. :loop2
  20. if j < 13:
  21. j += 1
  22. deckFace[] = j
  23. $deckImg[] = 'images/locations/city/industrial/casino/cards/<<$text>>/<<j>>.jpg'
  24. jump 'loop2'
  25. end
  26. jump 'loop1'
  27. end
  28. end
  29. if $ARGS[0] = 'shuffle':
  30. i = 0
  31. :loop3
  32. if i < 52:
  33. j = rand(0,51)
  34. temp = deckFace[i]
  35. deckFace[i] = deckFace[j]
  36. deckFace[j] = temp
  37. $text = $deckImg[i]
  38. $deckImg[i] = $deckImg[j]
  39. $deckImg[j] = $text
  40. i += 1
  41. jump 'loop3'
  42. end
  43. end
  44. --- deckShuffle ---------------------------------