SMStext_builder.qsrc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. # SMStext_builder
  2. ! How to use SMStext_builder:
  3. !
  4. ! Start with:
  5. ! gs 'SMStext_builder', 'start'
  6. ! Then add your content through "send" and "receive":
  7. ! gs 'SMStext_builder', 'send', [$text]
  8. ! gs 'SMStext_builder', 'receive', [$text]
  9. ! ...
  10. ! ...
  11. !
  12. ! If you want Sveta to reply to this (and thus the player potentially having a choice):
  13. ! gs 'SMStext_builder', 'add_reply', [$text], [$file_name], [$file_args0], [$file_args1], ...
  14. ! gs 'SMStext_builder', 'add_reply', [$text], [$file_name], [$file_args0], [$file_args1], ...
  15. !
  16. ! Finally, if this is a new sms-chain, use:
  17. ! gs 'SMStext_builder', 'add_sms', [$npc_code]
  18. !
  19. ! If you are updating an ongoing sms-chain (usually in reponse to a choice made in the replies), use:
  20. ! gs 'SMStext_builder', 'show_sms', ARGS[{n}]
  21. ! where {n} is one more than the number of args you passed to the choice.
  22. ! So if you are used:
  23. ! gs 'SMStext_builder', 'add_reply', [$text], [$file_name], [$file_args0], [$file_args1].
  24. ! Then you would pass ARGS[2] (since you used $ARGS[0] and $ARGS[1]):
  25. ! gs 'SMStext_builder', 'add_sms', ARGS[2]
  26. !
  27. ! Finally after the player has made a choice, you want to rebuild the SMS-history again (to get rid of the replies).
  28. ! Starting fresh or having done your final update (even if you never updated it anyway)
  29. ! End it with:
  30. ! gs 'SMStext_builder', 'end'
  31. if $ARGS[0] = 'start':
  32. $temp_SMStext = ''
  33. elseif $ARGS[0] = 'end':
  34. killvar '$temp_SMStext'
  35. killvar '$temp_SMSreplies'
  36. killvar 'stb_i'
  37. killvar 'stb_maxi'
  38. end
  39. if $ARGS[0] = 'send':
  40. $temp_SMStext += '<table width=80%><tr><td width=10%></td><td collspan=2 bgcolor=pink><font color=black>'
  41. $temp_SMStext += $ARGS[1]
  42. $temp_SMStext += '</font></td></tr></table>'
  43. elseif $ARGS[0] = 'receive':
  44. $temp_SMStext += '<table width=80%><tr><td collspan=2 bgcolor="#D4CEF9"><font color=black>'
  45. $temp_SMStext += $ARGS[1]
  46. $temp_SMStext += '</font></td><td width=10%></td></tr></table>'
  47. end
  48. ! How to use 'add_reply':
  49. ! gs 'SMStext_builder', 'add_reply', $reply_text, $file_loc, $file_arg1, $file_arg2, $file_args2, ...
  50. ! gs 'SMStext_builder', 'add_reply', 'Hello', 'band_tour_anushka_SMS', 'week1', 'choice_a'
  51. if $ARGS[0] = 'add_reply':
  52. $temp_reply_str = '<a href="exec: gs '
  53. stb_n_args = arrsize('$ARGS')
  54. stb_i = 2
  55. :SMS_build_reply_loop
  56. $temp_reply_str += '''<<$ARGS[stb_i]>>'', '
  57. stb_i += 1
  58. if stb_i < stb_n_args: jump 'SMS_build_reply_loop'
  59. $temp_reply_str += 'telefon[''SMSid'']">' + $ARGS[1] + '</a>'
  60. $temp_SMSreplies[] = $temp_reply_str
  61. killvar 'temp_reply_str'
  62. killvar 'stb_i'
  63. killvar 'stb_n_args'
  64. elseif $ARGS[0] = 'set_replies':
  65. $temp_SMStext += '<table><tr><th> Reply</th></tr><tr><td>'
  66. stb_maxi = arrsize('temp_SMSreplies')
  67. stb_i = 0
  68. if stb_maxi >= 2:
  69. :SMS_reply_loop
  70. $temp_SMStext += $temp_SMSreplies[stb_i]
  71. $temp_SMStext += '</td></tr><tr><td>'
  72. stb_i += 1
  73. if stb_i < stb_maxi - 1: jump 'SMS_reply_loop'
  74. end
  75. $temp_SMStext += $temp_SMSreplies[stb_i]
  76. $temp_SMStext += '</td></tr></table>'
  77. killvar '$temp_SMSreplies'
  78. killvar 'stb_i'
  79. killvar 'stb_maxi'
  80. end
  81. if $ARGS[0] = 'add_sms':
  82. if arrsize('temp_SMSreplies') > 0: gs 'SMStext_builder', 'set_replies'
  83. gs 'telefon', 'add_sms', $ARGS[1], $temp_SMStext, $ARGS[2], $ARGS[3], $ARGS[4], $ARGS[5]
  84. elseif $ARGS[0] = 'show_sms':
  85. if arrsize('temp_SMSreplies') > 0: gs 'SMStext_builder', 'set_replies'
  86. $SMSMessage[ARGS[1]] = $temp_SMStext
  87. gs 'telefon', 'show_sms', ARGS[1], $ARGS[2], $ARGS[3], $ARGS[4], $ARGS[5]
  88. end
  89. --- SMStext_builder ---------------------------------