grades.qsrc 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719
  1. # grades
  2. !!For handling the grades for classes in school, university adn other places the main character teke classes.
  3. !!First important thing is that to use these system to handle the characters grades for a class, it has to be initilized by the following call:
  4. !! gs 'grades', 'createclass', 'institution', 'name', 'number classes', 'number of optional in class educational activities', 'classes obligatory', 'use of homework', 'use computer in homework and out of class activities', 'number of out of class educational activities for max effectiveness'
  5. !! 'createclass' is just the name of this action.
  6. !! 'institution' is the institution where the classes take place. I can be 'school' for high-school or 'uni' for university. But you can also introduce a new place of education if you want. This is used to make sure that we can calculate averages, determine number of passed or failed classes in the give institution.
  7. !! 'name' is simply just the name of the class, make sure that the combination of institution and name is unique.
  8. !! 'number of classes' This is the number of classes that the character have each standard week. This number can be 0, but then the only weekly actions that affects grades are the out class educational ones.
  9. !! 'number of optional in class educational activities' is the number of actions that the character can do in a given class to improve their grades. Examples include pay attention, ask question. Remember when you write your class to include the given number of activities in each class.
  10. !! 'class obligatory' this is eithe 'yes' or 'no'. The difference between an obligatory class and a non obligatory is whether your in class performance is taking into account in your grade. Think the difference between a high-school where you grade is partially given by you teacher evaluating your performance throughout the year and a university lecture where your grade only depends on your performance at the exam.
  11. !! 'use of homework' this is an other 'yes' or 'no' question. This is if the class gives assignments as part of the daily homework. Specifically used to see if doing the daily homework contributes to the grade of this class.
  12. !! 'use computer in homework and out of class activities' this is to determine if the grade gain from doing homework or out of class activities is affected by access to a computer o not: 0 mean it is not affected, 1 means that the grade is affected if you do not use a computer and 2 means that the homework will not contribute to your grade if you do not use a computer.
  13. !! 'number of out of class educational activities for max effectiveness' this for classes that have repeatable study activities outside the class. This can for example be use for self study classes at university. The number is not the maximal number of a time the character can do these activities, but the number of times the character have to do them to get the maximal increase in grade id the associated attribute is 50 or skill is 15.
  14. !!When the character attends a class then remember to include the following
  15. !! gs 'grades', 'attend_class', 'institution', 'name' Here institution and name are the once you assigned when you created the class.
  16. !!Then remember to include a number af calls for activities during that class corresponding to the number of optional in class educational activities assigned when the class was created.
  17. !!Each activity should use one of the following 3 different calls.
  18. !! gs 'grades', 'class_activity', 'institution', 'name'
  19. !! gs 'grades', 'class_activity_skill', 'institution', 'name', skill
  20. !! gs 'grades', 'class_activity_attributes', 'institution', 'name', attribute
  21. !!The first is to be used if the activity is not to be modified by anything.
  22. !!The second is if the activity is going to be modified by a skill. This will in general only increase the grade gain from the activity up 85% (It can lower it if the skill is less than 15)
  23. !!The numerical argument 'skill' should be the skill you want to modify whit, for example if you want to use the characters dance skill it should be pcs_danc.
  24. !!If you want to modify it by more that one skill you need to decide how. For example if you want to modify by both the characters singing skill and the instrumental music skill, you could take the maximum which would be the max(psc_vokal,pcs_instrmusic) or you could take the average which would be (pcs_vokal+pcs_instrmusic)/2.
  25. !!These are just suggestions but remember that the result should return a number between 0 and 100.
  26. !!The third activity call is to be used if you want to modify by an attribute. This can half the grade gain if the attribute is 0 and increase it by 50% if the attribute is 100. If the attribute is 50 this will give the same as the unmodified call.
  27. !!If you want to modify by more than one attribute then you can do it by using one of the methods explained under the call modified by skill.
  28. !!Doing homweork is done by using the following call, remember to have the check lernHome >= number of homeworks before calling this to make sure that there is actually homework to do. The action will automatically lower this variable. Also remember that lernHome have to be increased by one for each day of school.
  29. !! gs 'grades', 'homework', 'institution', 'use of computer', 'number of homeworks', 'joint', 'npc identifier'
  30. !! 'institution' is which institution this is for.
  31. !! 'use of computer' is 'yes' if a computer was available for doing the homework and 'no' if not.
  32. !! 'number of homeworks' is the number of gomework assignments you want to do whit this one call. Remember to make sure that this number is not greater than lernHome.
  33. !! 'joint' 0 if you do the homework alone, 1 if you do it together with an npc, 2 if a npc does the homework for you, 3 use a modifier equal to the numbe set as the next argument.
  34. !! 'npc identifier' the npc identifier from npcstatic in the for A(number) for the npc helping/doing for you. If 'joint' = 3 then the number set here will be used as the modifier for doing the homework
  35. !!For a class where there is optional opportunities to study outside class that can effect the characters grade ther is th following three calls.
  36. !! gs 'grades', 'optional_activity', 'institution', 'name', 'use of computer'
  37. !! gs 'grades', 'optional_activity_skill', 'institution', 'name', 'use of computer', skill
  38. !! gs 'grades', 'optional_activity_attributes', 'institution', 'use of computer', 'name', attribute
  39. !!The difference between the three is how it is modified. This work exactly as for gs 'grades', 'class_activity'.
  40. !! 'use of computer' is 'yes' if a computer use to make the activity, 'no' if not. This modifies the grade gain depending of what was choose when the class was created.
  41. !!These optional activities can be called as many time as one want. the are particularly made for repeatable activities.
  42. !!The number of these optional activities chosen when the class created is how many time this activity have to be done with out modifies to achieve maximal grade gain in a given week.
  43. !!The modifiers mean that it can take more of less depending on skill, attributes and if a computer is used or not.
  44. !!For converting the weekly grade gain into change of the actual grade for the classes, the following should be called either in cikl Sunday night, or the first time the character enters the institution in a given week.
  45. !!Remember to call it for each institution the character attends.
  46. !! gs 'grades', 'calculate_grade', 'institution'
  47. !!Here are some other action that can be done using this file.
  48. !! gs 'grades', 'grade_cap', 'institution', 'name' number
  49. !!This make such that the grade can never go above the 'number' given (this should be a number less than 100). Can be used if a teacher don''t want to give higher grade for some reason.
  50. !! gs 'grades', 'grade_cap', 'institution', 'name'
  51. !!This removes any grade cap on the class.
  52. !! gs 'grades', 'grade_award', 'institution', 'name' number
  53. !!This add or subtract to number given from the grade directly, but respecting any cap on the grade. Can be used for giving the character a grade bonus or punishment for some discrete event. For example a bribe or punishment.
  54. !! gs 'grades', 'grades_above', 'institution', number
  55. !!This call set the variable class['<<institution>>_grades_above_<<number>>'] which returns the number of classes in institution which have a grade equal or higher than the number.
  56. !!This variable is not set automatically, so whenever you want to use it, remeber to make this call first.
  57. !!The following variable is set by this files for reference in events other places.
  58. !! class['<<institution>>_<<name>>_grade'], This is the grade of the class in institution by the name given.
  59. !! class['<<institution>>_grade_average'], This is the average of the grades in institution.
  60. if $ARGS[0] = 'createclass':
  61. !!This initialize a class, setting the parameters used to track the grades.
  62. if $ARGS[6] = 'yes':
  63. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain_max''] = 10*<<ARGS[3]>> + 10*<<ARGS[4]>>*<<ARGS[3]>> + 50 + 10*<<ARGS[8]>>'
  64. else
  65. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain_max''] = 10*<<ARGS[3]>> + 10*<<ARGS[4]>>*<<ARGS[3]>> + 10*<<ARGS[8]>>'
  66. end
  67. if $ARGS[5] = 'yes':
  68. if $ARGS[6] = 'yes':
  69. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain_breakeven_point''] = min(10*<<ARGS[3]>>+25, 5*<<ARGS[3]>> +50)'
  70. else
  71. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain_breakeven_point''] = 10*<<ARGS[3]>>'
  72. end
  73. elseif $ARGS[6] ='yes':
  74. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain_breakeven_point''] = 50'
  75. else
  76. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain_breakeven_point''] = 5*<<ARGS[8]>>'
  77. end
  78. if $ARGS[6] = 'yes': dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_homework''] = 1'
  79. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_max''] = 10*<<ARGS[8]>>'
  80. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_use_computer''] = <<ARGS[7]>>'
  81. !!i = dyneval ('RESULT = ARRSIZE(''<<$ARGS[1]>>_classes'')')
  82. !!dynamic '$<<$ARGS[1]>>_classes[i] = $ARGS[2]'
  83. i = ARRSIZE('class_list_institution')
  84. $class_list_institution[i] = $ARGS[1]
  85. $class_list_name[i] = $ARGS[2]
  86. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_grade_cap''] = 100'
  87. end
  88. if $ARGS[0] = 'grade_cap':
  89. !!This set a cap on the grade of the class. Used if something are preventing the character for obtaining a higher grade, for example a teacher mad at the character.
  90. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_grade_cap''] = <<ARGS[3]>>'
  91. if dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_grade'']') > dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_grade_cap'']'):
  92. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_grade''] = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_grade_cap'']'
  93. end
  94. end
  95. if $ARGS[0] = 'grade_cap_removed':
  96. !!Remove the above cap.
  97. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_grade_cap''] = 100'
  98. end
  99. if $ARGS[0] = 'attend_class':
  100. !!This adds the point for attending a class. Also the first time it is called in a given day it register that there will be classes that day.
  101. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_class_day_<<week>>''] = 1'
  102. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 10'
  103. end
  104. if $ARGS[0] = 'class_activity':
  105. !!This adds the point for doing an in class activity that is not modified.
  106. if pcs_stam <= 0:
  107. if pcs_condition['lack_of_sleep'] >= 20:
  108. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 1'
  109. elseif pcs_condition['lack_of_sleep'] >= 10:
  110. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 2'
  111. elseif pcs_condition['lack_of_sleep'] >= 5:
  112. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 3'
  113. elseif pcs_condition['lack_of_sleep'] >= 2:
  114. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 5'
  115. else
  116. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 5'
  117. end
  118. elseif pcs_stam < stammax / 5:
  119. if pcs_condition['lack_of_sleep'] >= 20:
  120. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 2'
  121. elseif pcs_condition['lack_of_sleep'] >= 10:
  122. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 4'
  123. elseif pcs_condition['lack_of_sleep'] >= 5:
  124. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 6'
  125. elseif pcs_condition['lack_of_sleep'] >= 2:
  126. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 8'
  127. else
  128. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 9'
  129. end
  130. else
  131. if pcs_condition['lack_of_sleep'] >= 20:
  132. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 2'
  133. elseif pcs_condition['lack_of_sleep'] >= 10:
  134. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 5'
  135. elseif pcs_condition['lack_of_sleep'] >= 5:
  136. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 7'
  137. elseif pcs_condition['lack_of_sleep'] >= 2:
  138. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 9'
  139. else
  140. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 10'
  141. end
  142. end
  143. end
  144. if $ARGS[0] = 'class_activity_skill':
  145. !!This adds the point for doing an in class activity modified by a skill.
  146. if pcs_stam <= 0:
  147. if pcs_condition['lack_of_sleep'] >= 20:
  148. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (2*(85+<<ARGS[3]>>))/200'
  149. elseif pcs_condition['lack_of_sleep'] >= 10:
  150. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (5*(85+<<ARGS[3]>>))/200'
  151. elseif pcs_condition['lack_of_sleep'] >= 5:
  152. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (7*(85+<<ARGS[3]>>))/200'
  153. elseif pcs_condition['lack_of_sleep'] >= 2:
  154. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (9*(85+<<ARGS[3]>>))/200'
  155. else
  156. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (10*(85+<<ARGS[3]>>))/200'
  157. end
  158. elseif pcs_stam < stammax / 5:
  159. if pcs_condition['lack_of_sleep'] >= 20:
  160. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (6*(85+<<ARGS[3]>>))/400'
  161. elseif pcs_condition['lack_of_sleep'] >= 10:
  162. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (15*(85+<<ARGS[3]>>))/400'
  163. elseif pcs_condition['lack_of_sleep'] >= 5:
  164. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (21*(85+<<ARGS[3]>>))/400'
  165. elseif pcs_condition['lack_of_sleep'] >= 2:
  166. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (27*(85+<<ARGS[3]>>))/400'
  167. else
  168. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (30*(85+<<ARGS[3]>>))/400'
  169. end
  170. else
  171. if pcs_condition['lack_of_sleep'] >= 20:
  172. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (2*(85+<<ARGS[3]>>))/100'
  173. elseif pcs_condition['lack_of_sleep'] >= 10:
  174. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (5*(85+<<ARGS[3]>>))/100'
  175. elseif pcs_condition['lack_of_sleep'] >= 5:
  176. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (7*(85+<<ARGS[3]>>))/100'
  177. elseif pcs_condition['lack_of_sleep'] >= 2:
  178. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (9*(85+<<ARGS[3]>>))/100'
  179. else
  180. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (10*(85+<<ARGS[3]>>))/100'
  181. end
  182. end
  183. end
  184. if $ARGS[0] = 'class_activity_attributes':
  185. !!This adds the point for doing an in class activity modified by an attributes.
  186. if pcs_stam <= 0:
  187. if pcs_condition['lack_of_sleep'] >= 20:
  188. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (2*(50+<<ARGS[3]>>))/200'
  189. elseif pcs_condition['lack_of_sleep'] >= 10:
  190. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (5*(50+<<ARGS[3]>>))/200'
  191. elseif pcs_condition['lack_of_sleep'] >= 5:
  192. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (7*(50+<<ARGS[3]>>))/200'
  193. elseif pcs_condition['lack_of_sleep'] >= 2:
  194. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (9*(50+<<ARGS[3]>>))/200'
  195. else
  196. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (10*(50+<<ARGS[3]>>))/200'
  197. end
  198. elseif pcs_stam < stammax / 5:
  199. if pcs_condition['lack_of_sleep'] >= 20:
  200. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (6*(50+<<ARGS[3]>>))/400'
  201. elseif pcs_condition['lack_of_sleep'] >= 10:
  202. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (15*(50+<<ARGS[3]>>))/400'
  203. elseif pcs_condition['lack_of_sleep'] >= 5:
  204. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (21*(50+<<ARGS[3]>>))/400'
  205. elseif pcs_condition['lack_of_sleep'] >= 2:
  206. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (27*(50+<<ARGS[3]>>))/400'
  207. else
  208. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (30*(50+<<ARGS[3]>>))/400'
  209. end
  210. else
  211. if pcs_condition['lack_of_sleep'] >= 20:
  212. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (2*(50+<<ARGS[3]>>))/100'
  213. elseif pcs_condition['lack_of_sleep'] >= 10:
  214. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (5*(50+<<ARGS[3]>>))/100'
  215. elseif pcs_condition['lack_of_sleep'] >= 5:
  216. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (7*(50+<<ARGS[3]>>))/100'
  217. elseif pcs_condition['lack_of_sleep'] >= 2:
  218. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (9*(50+<<ARGS[3]>>))/100'
  219. else
  220. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (10*(50+<<ARGS[3]>>))/100'
  221. end
  222. end
  223. end
  224. if $ARGS[0] = 'optional_activity':
  225. !!This adds the point for doing an optional out of class activity that is not modified.
  226. if dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_use_computer'']') = 0 or $ARGS[3] = 'yes':
  227. if pcs_stam <= 0:
  228. if pcs_condition['lack_of_sleep'] >= 20:
  229. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 1'
  230. elseif pcs_condition['lack_of_sleep'] >= 10:
  231. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 2'
  232. elseif pcs_condition['lack_of_sleep'] >= 5:
  233. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 3'
  234. elseif pcs_condition['lack_of_sleep'] >= 2:
  235. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 4'
  236. else
  237. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 5'
  238. end
  239. elseif pcs_stam < stammax / 5:
  240. if pcs_condition['lack_of_sleep'] >= 20:
  241. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 2'
  242. elseif pcs_condition['lack_of_sleep'] >= 10:
  243. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 4'
  244. elseif pcs_condition['lack_of_sleep'] >= 5:
  245. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 6'
  246. elseif pcs_condition['lack_of_sleep'] >= 2:
  247. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 8'
  248. else
  249. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 9'
  250. end
  251. else
  252. if pcs_condition['lack_of_sleep'] >= 20:
  253. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 2'
  254. elseif pcs_condition['lack_of_sleep'] >= 10:
  255. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 5'
  256. elseif pcs_condition['lack_of_sleep'] >= 5:
  257. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 7'
  258. elseif pcs_condition['lack_of_sleep'] >= 2:
  259. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 9'
  260. else
  261. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 10'
  262. end
  263. end
  264. elseif dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_use_computer'']') = 1:
  265. if pcs_stam <= 0:
  266. if pcs_condition['lack_of_sleep'] >= 20:
  267. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 1'
  268. elseif pcs_condition['lack_of_sleep'] >= 10:
  269. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 1'
  270. elseif pcs_condition['lack_of_sleep'] >= 5:
  271. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 2'
  272. elseif pcs_condition['lack_of_sleep'] >= 2:
  273. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 2'
  274. else
  275. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 3'
  276. end
  277. elseif pcs_stam < stammax / 5:
  278. if pcs_condition['lack_of_sleep'] >= 20:
  279. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 1'
  280. elseif pcs_condition['lack_of_sleep'] >= 10:
  281. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 2'
  282. elseif pcs_condition['lack_of_sleep'] >= 5:
  283. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 2'
  284. elseif pcs_condition['lack_of_sleep'] >= 2:
  285. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 3'
  286. else
  287. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 4'
  288. end
  289. else
  290. if pcs_condition['lack_of_sleep'] >= 20:
  291. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 1'
  292. elseif pcs_condition['lack_of_sleep'] >= 10:
  293. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 2'
  294. elseif pcs_condition['lack_of_sleep'] >= 5:
  295. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 3'
  296. elseif pcs_condition['lack_of_sleep'] >= 2:
  297. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 4'
  298. else
  299. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 5'
  300. end
  301. end
  302. end
  303. if dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain'']') > dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_max'']'):
  304. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_max'']'
  305. end
  306. end
  307. if $ARGS[0] = 'optional_activity_skill':
  308. !!This adds the point for doing an optional out of class activity modified by a skill.
  309. if dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_use_computer'']') = 0 or $ARGS[3] = 'yes':
  310. if pcs_stam <= 0:
  311. if pcs_condition['lack_of_sleep'] >= 20:
  312. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (2*(85+<<ARGS[4]>>))/200'
  313. elseif pcs_condition['lack_of_sleep'] >= 10:
  314. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (5*(85+<<ARGS[4]>>))/200'
  315. elseif pcs_condition['lack_of_sleep'] >= 5:
  316. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (7*(85+<<ARGS[4]>>))/200'
  317. elseif pcs_condition['lack_of_sleep'] >= 2:
  318. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (9*(85+<<ARGS[4]>>))/200'
  319. else
  320. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (10*(85+<<ARGS[4]>>))/200'
  321. end
  322. elseif pcs_stam < stammax / 5:
  323. if pcs_condition['lack_of_sleep'] >= 20:
  324. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (6*(85+<<ARGS[4]>>))/400'
  325. elseif pcs_condition['lack_of_sleep'] >= 10:
  326. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (15*(85+<<ARGS[4]>>))/400'
  327. elseif pcs_condition['lack_of_sleep'] >= 5:
  328. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (21*(85+<<ARGS[4]>>))/400'
  329. elseif pcs_condition['lack_of_sleep'] >= 2:
  330. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (27*(85+<<ARGS[4]>>))/400'
  331. else
  332. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (30*(85+<<ARGS[4]>>))/400'
  333. end
  334. else
  335. if pcs_condition['lack_of_sleep'] >= 20:
  336. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (2*(85+<<ARGS[4]>>))/100'
  337. elseif pcs_condition['lack_of_sleep'] >= 10:
  338. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (5*(85+<<ARGS[4]>>))/100'
  339. elseif pcs_condition['lack_of_sleep'] >= 5:
  340. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (7*(85+<<ARGS[4]>>))/100'
  341. elseif pcs_condition['lack_of_sleep'] >= 2:
  342. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (9*(85+<<ARGS[4]>>))/100'
  343. else
  344. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (10*(85+<<ARGS[4]>>))/100'
  345. end
  346. end
  347. elseif dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_use_computer'']') = 1:
  348. if pcs_stam <= 0:
  349. if pcs_condition['lack_of_sleep'] >= 20:
  350. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (1*(85+<<ARGS[4]>>))/200'
  351. elseif pcs_condition['lack_of_sleep'] >= 10:
  352. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (2*(85+<<ARGS[4]>>))/200'
  353. elseif pcs_condition['lack_of_sleep'] >= 5:
  354. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (3*(85+<<ARGS[4]>>))/200'
  355. elseif pcs_condition['lack_of_sleep'] >= 2:
  356. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (4*(85+<<ARGS[4]>>))/200'
  357. else
  358. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (5*(85+<<ARGS[4]>>))/200'
  359. end
  360. elseif pcs_stam < stammax / 5:
  361. if pcs_condition['lack_of_sleep'] >= 20:
  362. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (3*(85+<<ARGS[4]>>))/400'
  363. elseif pcs_condition['lack_of_sleep'] >= 10:
  364. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (6*(85+<<ARGS[4]>>))/400'
  365. elseif pcs_condition['lack_of_sleep'] >= 5:
  366. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (9*(85+<<ARGS[4]>>))/400'
  367. elseif pcs_condition['lack_of_sleep'] >= 2:
  368. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (12*(85+<<ARGS[4]>>))/400'
  369. else
  370. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (15*(85+<<ARGS[4]>>))/400'
  371. end
  372. else
  373. if pcs_condition['lack_of_sleep'] >= 20:
  374. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (1*(85+<<ARGS[4]>>))/100'
  375. elseif pcs_condition['lack_of_sleep'] >= 10:
  376. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (2*(85+<<ARGS[4]>>))/100'
  377. elseif pcs_condition['lack_of_sleep'] >= 5:
  378. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (3*(85+<<ARGS[4]>>))/100'
  379. elseif pcs_condition['lack_of_sleep'] >= 2:
  380. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (4*(85+<<ARGS[4]>>))/100'
  381. else
  382. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (5*(85+<<ARGS[4]>>))/100'
  383. end
  384. end
  385. end
  386. if dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain'']') > dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_max'']'):
  387. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_max'']'
  388. end
  389. end
  390. if $ARGS[0] = 'optional_activity_attribute':
  391. !!This adds the point for doing an optional out of class activity modified by an attributes.
  392. if dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_use_computer'']') = 0 or $ARGS[3] = 'yes':
  393. if pcs_stam <= 0:
  394. if pcs_condition['lack_of_sleep'] >= 20:
  395. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (2*(50+<<ARGS[4]>>))/200'
  396. elseif pcs_condition['lack_of_sleep'] >= 10:
  397. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (5*(50+<<ARGS[4]>>))/200'
  398. elseif pcs_condition['lack_of_sleep'] >= 5:
  399. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (7*(50+<<ARGS[4]>>))/200'
  400. elseif pcs_condition['lack_of_sleep'] >= 2:
  401. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (9*(50+<<ARGS[4]>>))/200'
  402. else
  403. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (10*(50+<<ARGS[4]>>))/200'
  404. end
  405. elseif pcs_stam < stammax / 5:
  406. if pcs_condition['lack_of_sleep'] >= 20:
  407. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (6*(50+<<ARGS[4]>>))/400'
  408. elseif pcs_condition['lack_of_sleep'] >= 10:
  409. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (15*(50+<<ARGS[4]>>))/400'
  410. elseif pcs_condition['lack_of_sleep'] >= 5:
  411. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (21*(50+<<ARGS[4]>>))/400'
  412. elseif pcs_condition['lack_of_sleep'] >= 2:
  413. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (27*(50+<<ARGS[4]>>))/400'
  414. else
  415. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (30*(50+<<ARGS[4]>>))/400'
  416. end
  417. else
  418. if pcs_condition['lack_of_sleep'] >= 20:
  419. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (2*(50+<<ARGS[4]>>))/100'
  420. elseif pcs_condition['lack_of_sleep'] >= 10:
  421. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (5*(50+<<ARGS[4]>>))/100'
  422. elseif pcs_condition['lack_of_sleep'] >= 5:
  423. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (7*(50+<<ARGS[4]>>))/100'
  424. elseif pcs_condition['lack_of_sleep'] >= 2:
  425. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (9*(50+<<ARGS[4]>>))/100'
  426. else
  427. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (10*(50+<<ARGS[4]>>))/100'
  428. end
  429. end
  430. elseif dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_use_computer'']') = 1:
  431. if pcs_stam <= 0:
  432. if pcs_condition['lack_of_sleep'] >= 20:
  433. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (1*(50+<<ARGS[4]>>))/200'
  434. elseif pcs_condition['lack_of_sleep'] >= 10:
  435. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (2*(50+<<ARGS[4]>>))/200'
  436. elseif pcs_condition['lack_of_sleep'] >= 5:
  437. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (3*(50+<<ARGS[4]>>))/200'
  438. elseif pcs_condition['lack_of_sleep'] >= 2:
  439. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (4*(50+<<ARGS[4]>>))/200'
  440. else
  441. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (5*(50+<<ARGS[4]>>))/200'
  442. end
  443. elseif pcs_stam < stammax / 5:
  444. if pcs_condition['lack_of_sleep'] >= 20:
  445. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (3*(50+<<ARGS[4]>>))/400'
  446. elseif pcs_condition['lack_of_sleep'] >= 10:
  447. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (6*(50+<<ARGS[4]>>))/400'
  448. elseif pcs_condition['lack_of_sleep'] >= 5:
  449. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (9*(50+<<ARGS[4]>>))/400'
  450. elseif pcs_condition['lack_of_sleep'] >= 2:
  451. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (12*(50+<<ARGS[4]>>))/400'
  452. else
  453. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (15*(50+<<ARGS[4]>>))/400'
  454. end
  455. else
  456. if pcs_condition['lack_of_sleep'] >= 20:
  457. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (1*(50+<<ARGS[4]>>))/100'
  458. elseif pcs_condition['lack_of_sleep'] >= 10:
  459. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (2*(50+<<ARGS[4]>>))/100'
  460. elseif pcs_condition['lack_of_sleep'] >= 5:
  461. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (3*(50+<<ARGS[4]>>))/100'
  462. elseif pcs_condition['lack_of_sleep'] >= 2:
  463. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (4*(50+<<ARGS[4]>>))/100'
  464. else
  465. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (5*(50+<<ARGS[4]>>))/100'
  466. end
  467. end
  468. end
  469. if dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain'']') > dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_max'']'):
  470. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_max'']'
  471. end
  472. end
  473. if $ARGS[0] = 'homework':
  474. !!For doing the daily homework.
  475. lernHome -= ARGS[3]
  476. !!The modifier for doing home work is the characters intelligence if that do it alone, the intelligence of the npc that make it for them (but at least 50), or the maximum of the intelligence of the character and the npc the are doing it together with, with a small bonus if there intelligence is close, or the value set as ARGs[5].
  477. if ARGS[4] = 2:
  478. modifier = dyneval('RESULT = max(npc_intel[''<<$ARGS[5]>>''], 50)')
  479. elseif ARGS[4] = 1:
  480. modifier = dyneval('RESULT = max(npc_intel[''<<$ARGS[5]>>''], pcs_intel) + (max(10+min(npc_intel[''<<$ARGS[5]>>''] -pcs_intel, pcs_intel -npc_intel[''<<$ARGS[5]>>'']),0)*(100 - max(npc_intel[''<<$ARGS[5]>>''], pcs_intel)))/50')
  481. elseif ARGS[4] = 3:
  482. modifier = ARGS[5]
  483. else
  484. modifier = pcs_intel
  485. end
  486. i=0
  487. :homework_loop
  488. if $class_list_institution[i] = $ARGS[1]:
  489. if dyneval ('RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_homework'']') = 1:
  490. if $ARGS[2] = 'no':
  491. if pcs_stam <= 0:
  492. if pcs_condition['lack_of_sleep'] >= 20:
  493. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*1*(50+modifier))/200)'
  494. elseif pcs_condition['lack_of_sleep'] >= 10:
  495. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*2*(50+modifier))/200)'
  496. elseif pcs_condition['lack_of_sleep'] >= 5:
  497. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*3*(50+modifier))/200)'
  498. elseif pcs_condition['lack_of_sleep'] >= 2:
  499. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*4*(50+modifier))/200)'
  500. else
  501. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*5*(50+modifier))/200)'
  502. end
  503. elseif pcs_stam < stammax / 5:
  504. if pcs_condition['lack_of_sleep'] >= 20:
  505. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*3*(50+modifier))/400)'
  506. elseif pcs_condition['lack_of_sleep'] >= 10:
  507. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*6*(50+modifier))/400)'
  508. elseif pcs_condition['lack_of_sleep'] >= 5:
  509. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*9*(50+modifier))/400)'
  510. elseif pcs_condition['lack_of_sleep'] >= 2:
  511. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*12*(50+modifier))/400)'
  512. else
  513. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*15*(50+modifier))/400)'
  514. end
  515. else
  516. if pcs_condition['lack_of_sleep'] >= 20:
  517. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*1*(50+modifier))/100)'
  518. elseif pcs_condition['lack_of_sleep'] >= 10:
  519. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*2*(50+modifier))/100)'
  520. elseif pcs_condition['lack_of_sleep'] >= 5:
  521. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*3*(50+modifier))/100)'
  522. elseif pcs_condition['lack_of_sleep'] >= 2:
  523. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*4*(50+modifier))/100)'
  524. else
  525. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*5*(50+modifier))/100)'
  526. end
  527. end
  528. else
  529. if pcs_stam <= 0:
  530. if pcs_condition['lack_of_sleep'] >= 20:
  531. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((2*(50+modifier))/200)'
  532. elseif pcs_condition['lack_of_sleep'] >= 10:
  533. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((5*(50+modifier))/200)'
  534. elseif pcs_condition['lack_of_sleep'] >= 5:
  535. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((7*(50+modifier))/200)'
  536. elseif pcs_condition['lack_of_sleep'] >= 2:
  537. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((9*(50+modifier))/200)'
  538. else
  539. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((10*(50+modifier))/200)'
  540. end
  541. elseif pcs_stam < stammax / 5:
  542. if pcs_condition['lack_of_sleep'] >= 20:
  543. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((6*(50+modifier))/400)'
  544. elseif pcs_condition['lack_of_sleep'] >= 10:
  545. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((15*(50+modifier))/400)'
  546. elseif pcs_condition['lack_of_sleep'] >= 5:
  547. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((21*(50+modifier))/400)'
  548. elseif pcs_condition['lack_of_sleep'] >= 2:
  549. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((27*(50+modifier))/400)'
  550. else
  551. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((30*(50+modifier))/400)'
  552. end
  553. else
  554. if pcs_condition['lack_of_sleep'] >= 20:
  555. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((2*(50+modifier))/100)'
  556. elseif pcs_condition['lack_of_sleep'] >= 10:
  557. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((5*(50+modifier))/100)'
  558. elseif pcs_condition['lack_of_sleep'] >= 5:
  559. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((7*(50+modifier))/100)'
  560. elseif pcs_condition['lack_of_sleep'] >= 2:
  561. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((9*(50+modifier))/100)'
  562. else
  563. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((10*(50+modifier))/100)'
  564. end
  565. end
  566. end
  567. end
  568. end
  569. i +=1
  570. if ARRSIZE('class_list_institution') >= i: jump 'homework_loop'
  571. killvar 'modifier'
  572. end
  573. if $ARGS[0] = 'grade_award':
  574. !!This changes the grade directly of ARGS[3]
  575. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_grade''] += <<ARGS[3]>>'
  576. if dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_grade'']') > dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_grade_cap'']'):
  577. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_grade''] = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_grade_cap'']'
  578. end
  579. if dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_grade'']') < 0:
  580. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_grade''] = 0'
  581. end
  582. temp = 0
  583. n = 0
  584. i=0
  585. :grade_loop
  586. if $class_list_institution[i] = $ARGS[1]:
  587. temp += dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']')
  588. n += 1
  589. end
  590. i +=1
  591. if ARRSIZE('class_list_institution') > i: jump 'grade_loop'
  592. if n > 0: dynamic 'class[''<<$ARGS[1]>>_grade_average''] = temp/n'
  593. killvar 'temp'
  594. killvar 'n'
  595. killvar 'i'
  596. end
  597. if $ARGS[0] = 'calculate_grade':
  598. !!This calculates the change in grade for each class in the institution $ARGS[1] at the end of the week. Should either be called from cikl when we move from Sunday to Monday, or the first time the character enters the institution in a given week.
  599. temp = 0
  600. n = 0
  601. i=0
  602. :grade_loop1
  603. if $class_list_institution[i] = $ARGS[1]:
  604. !!$i = dyneval ('RESULT = $<<$ARGS[1]>>_classes[i]')
  605. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_optional_weekly_grade_gain'']'
  606. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_optional_weekly_grade_gain''] = 0'
  607. if dyneval ('RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain'']') < dyneval('RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain_breakeven_point'']'):
  608. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] -= (5 - (5*class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''])/class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain_breakeven_point''])'
  609. else
  610. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] += (3*(class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain'']-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain_breakeven_point'']))/(class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain_max''] -class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain_breakeven_point''])'
  611. end
  612. if dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') > dyneval('RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade_cap'']'):
  613. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade_cap'']'
  614. end
  615. temp += dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']')
  616. n += 1
  617. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] = 0'
  618. end
  619. i +=1
  620. if ARRSIZE('class_list_institution') > i: jump 'grade_loop1'
  621. if n > 0: dynamic 'class[''<<$ARGS[1]>>_grade_average''] = temp/n'
  622. killvar 'temp'
  623. killvar 'n'
  624. killvar 'i'
  625. end
  626. if $ARGS[0] = 'assing_grade_description':
  627. i=0
  628. :assing_grade_loop
  629. if $class_list_institution[i] = $ARGS[1]:
  630. if dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') < 10:
  631. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''1'' '
  632. elseif dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') < 20:
  633. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''2-'' '
  634. elseif dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') < 35:
  635. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''2'' '
  636. elseif dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') < 40:
  637. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''2+'' '
  638. elseif dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') < 50:
  639. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''3-'' '
  640. elseif dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') < 65:
  641. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''3'' '
  642. elseif dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') < 70:
  643. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''3+'' '
  644. elseif dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') < 75:
  645. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''4-'' '
  646. elseif dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') < 86:
  647. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''4'' '
  648. elseif dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') < 90:
  649. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''4+'' '
  650. elseif dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') < 92:
  651. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''5-'' '
  652. elseif dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') < 97:
  653. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''5'' '
  654. else
  655. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''5+'' '
  656. end
  657. end
  658. i += 1
  659. if ARRSIZE('class_list_institution') >= i: jump 'assing_grade_loop'
  660. end
  661. if $ARGS[0] = 'grade above':
  662. !!This set the variable class['<<$ARGS[1]>>_grades_above_<<ARGS[2]>>'] which have the value of the number of classes in the institution that is above ARGS[2]. This only update when this gosub is called. It does not update automatically. So if you want to use it call this gosub first.
  663. dynamic 'class[''<<$ARGS[1]>>_grades_above_<<ARGS[2]>>''] = 0'
  664. i=0
  665. :grade_above_loop
  666. !!$i = dyneval ('RESULT = $<<$ARGS[1]>>_classes[i]')
  667. if $class_list_institution[i] = $ARGS[1]:
  668. if dyneval ('RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') >= ARGS[2]:
  669. dynamic 'class[''<<$ARGS[1]>>_grades_above_<<ARGS[2]>>''] += 1'
  670. end
  671. end
  672. i +=1
  673. if ARRSIZE('class_list_institution') >= i: jump 'grade_above_loop'
  674. !!if dyneval ('RESULT = ARRSIZE(''<<$ARGS[1]>>_classes'')') >= i: jump 'grade_above_loop'
  675. end
  676. --- grades ---------------------------------