grades.qsrc 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  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_condition['lack_of_sleep'] >= 20:
  107. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 2'
  108. elseif pcs_condition['lack_of_sleep'] >= 10:
  109. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 5'
  110. elseif pcs_condition['lack_of_sleep'] >= 5:
  111. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 7'
  112. elseif pcs_condition['lack_of_sleep'] >= 2:
  113. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 9'
  114. else
  115. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 10'
  116. end
  117. end
  118. if $ARGS[0] = 'class_activity_skill':
  119. !!This adds the point for doing an in class activity modified by a skill.
  120. if pcs_condition['lack_of_sleep'] >= 20:
  121. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (2*(85+<<ARGS[3]>>))/100'
  122. elseif pcs_condition['lack_of_sleep'] >= 10:
  123. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (5*(85+<<ARGS[3]>>))/100'
  124. elseif pcs_condition['lack_of_sleep'] >= 5:
  125. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (7*(85+<<ARGS[3]>>))/100'
  126. elseif pcs_condition['lack_of_sleep'] >= 2:
  127. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (9*(85+<<ARGS[3]>>))/100'
  128. else
  129. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (10*(85+<<ARGS[3]>>))/100'
  130. end
  131. end
  132. if $ARGS[0] = 'class_activity_attributes':
  133. !!This adds the point for doing an in class activity modified by an attributes.
  134. if pcs_condition['lack_of_sleep'] >= 20:
  135. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (2*(50+<<ARGS[3]>>))/100'
  136. elseif pcs_condition['lack_of_sleep'] >= 10:
  137. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (5*(50+<<ARGS[3]>>))/100'
  138. elseif pcs_condition['lack_of_sleep'] >= 5:
  139. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (7*(50+<<ARGS[3]>>))/100'
  140. elseif pcs_condition['lack_of_sleep'] >= 2:
  141. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (9*(50+<<ARGS[3]>>))/100'
  142. else
  143. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (10*(50+<<ARGS[3]>>))/100'
  144. end
  145. end
  146. if $ARGS[0] = 'optional_activity':
  147. !!This adds the point for doing an optional out of class activity that is not modified.
  148. if dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_use_computer'']') = 0 or $ARGS[3] = 'yes':
  149. if pcs_condition['lack_of_sleep'] >= 20:
  150. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 2'
  151. elseif pcs_condition['lack_of_sleep'] >= 10:
  152. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 5'
  153. elseif pcs_condition['lack_of_sleep'] >= 5:
  154. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 7'
  155. elseif pcs_condition['lack_of_sleep'] >= 2:
  156. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 9'
  157. else
  158. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 10'
  159. end
  160. elseif dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_use_computer'']') = 1:
  161. if pcs_condition['lack_of_sleep'] >= 20:
  162. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 1'
  163. elseif pcs_condition['lack_of_sleep'] >= 10:
  164. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 2'
  165. elseif pcs_condition['lack_of_sleep'] >= 5:
  166. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 3'
  167. elseif pcs_condition['lack_of_sleep'] >= 2:
  168. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 4'
  169. else
  170. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 5'
  171. end
  172. end
  173. if dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain'']') > dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_max'']'):
  174. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_max'']'
  175. end
  176. end
  177. if $ARGS[0] = 'optional_activity_skill':
  178. !!This adds the point for doing an optional out of class activity modified by a skill.
  179. if dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_use_computer'']') = 0 or $ARGS[3] = 'yes':
  180. if pcs_condition['lack_of_sleep'] >= 20:
  181. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (2*(85+<<ARGS[3]>>))/100'
  182. elseif pcs_condition['lack_of_sleep'] >= 10:
  183. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (5*(85+<<ARGS[3]>>))/100'
  184. elseif pcs_condition['lack_of_sleep'] >= 5:
  185. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (7*(85+<<ARGS[3]>>))/100'
  186. elseif pcs_condition['lack_of_sleep'] >= 2:
  187. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (9*(85+<<ARGS[3]>>))/100'
  188. else
  189. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (10*(85+<<ARGS[4]>>))/100'
  190. end
  191. elseif dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_use_computer'']') = 1:
  192. if pcs_condition['lack_of_sleep'] >= 20:
  193. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (1*(85+<<ARGS[3]>>))/100'
  194. elseif pcs_condition['lack_of_sleep'] >= 10:
  195. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (2*(85+<<ARGS[3]>>))/100'
  196. elseif pcs_condition['lack_of_sleep'] >= 5:
  197. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (3*(85+<<ARGS[3]>>))/100'
  198. elseif pcs_condition['lack_of_sleep'] >= 2:
  199. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (4*(85+<<ARGS[3]>>))/100'
  200. else
  201. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (5*(85+<<ARGS[4]>>))/100'
  202. end
  203. end
  204. if dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain'']') > dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_max'']'):
  205. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_max'']'
  206. end
  207. end
  208. if $ARGS[0] = 'optional_activity_attribute':
  209. !!This adds the point for doing an optional out of class activity modified by an attributes.
  210. if dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_use_computer'']') = 0 or $ARGS[3] = 'yes':
  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]>>_optional_weekly_grade_gain''] += (10*(50+<<ARGS[4]>>))/100'
  221. end
  222. elseif dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_use_computer'']') = 1:
  223. if pcs_condition['lack_of_sleep'] >= 20:
  224. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (1*(50+<<ARGS[3]>>))/100'
  225. elseif pcs_condition['lack_of_sleep'] >= 10:
  226. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (2*(50+<<ARGS[3]>>))/100'
  227. elseif pcs_condition['lack_of_sleep'] >= 5:
  228. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (3*(50+<<ARGS[3]>>))/100'
  229. elseif pcs_condition['lack_of_sleep'] >= 2:
  230. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (4*(50+<<ARGS[3]>>))/100'
  231. else
  232. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (5*(50+<<ARGS[4]>>))/100'
  233. end
  234. end
  235. if dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain'']') > dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_max'']'):
  236. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_max'']'
  237. end
  238. end
  239. if $ARGS[0] = 'homework':
  240. !!For doing the daily homework.
  241. lernHome -= ARGS[3]
  242. !!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].
  243. if ARGS[4] = 2:
  244. modifier = dyneval('RESULT = max(npc_intel[''<<$ARGS[5]>>''], 50)')
  245. elseif ARGS[4] = 1:
  246. 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')
  247. elseif ARGS[4] = 3:
  248. modifier = ARGS[5]
  249. else
  250. modifier = pcs_intel
  251. end
  252. i=0
  253. :homework_loop
  254. if $class_list_institution[i] = $ARGS[1]:
  255. if dyneval ('RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_homework'']') = 1:
  256. if $ARGS[2] = 'no':
  257. if pcs_condition['lack_of_sleep'] >= 20:
  258. 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)'
  259. elseif pcs_condition['lack_of_sleep'] >= 10:
  260. 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)'
  261. elseif pcs_condition['lack_of_sleep'] >= 5:
  262. 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)'
  263. elseif pcs_condition['lack_of_sleep'] >= 2:
  264. 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)'
  265. else
  266. 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)'
  267. end
  268. else
  269. if pcs_condition['lack_of_sleep'] >= 20:
  270. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((2*(50+modifier))/100)'
  271. elseif pcs_condition['lack_of_sleep'] >= 10:
  272. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((5*(50+modifier))/100)'
  273. elseif pcs_condition['lack_of_sleep'] >= 5:
  274. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((7*(50+modifier))/100)'
  275. elseif pcs_condition['lack_of_sleep'] >= 2:
  276. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((9*(50+modifier))/100)'
  277. else
  278. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((10*(50+modifier))/100)'
  279. end
  280. end
  281. end
  282. end
  283. i +=1
  284. if ARRSIZE('class_list_institution') >= i: jump 'homework_loop'
  285. killvar 'modifier'
  286. end
  287. if $ARGS[0] = 'grade_award':
  288. !!This changes the grade directly of ARGS[3]
  289. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_grade''] += <<ARGS[3]>>'
  290. if dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_grade'']') > dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_grade_cap'']'):
  291. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_grade''] = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_grade_cap'']'
  292. end
  293. if dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_grade'']') < 0:
  294. dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_grade''] = 0'
  295. end
  296. temp = 0
  297. n = 0
  298. i=0
  299. :grade_loop
  300. if $class_list_institution[i] = $ARGS[1]:
  301. temp += dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']')
  302. n += 1
  303. end
  304. i +=1
  305. if ARRSIZE('class_list_institution') > i: jump 'grade_loop'
  306. if n > 0: dynamic 'class[''<<$ARGS[1]>>_grade_average''] = temp/n'
  307. killvar 'temp'
  308. killvar 'n'
  309. killvar 'i'
  310. end
  311. if $ARGS[0] = 'calculate_grade':
  312. !!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.
  313. temp = 0
  314. n = 0
  315. i=0
  316. :grade_loop1
  317. if $class_list_institution[i] = $ARGS[1]:
  318. !!$i = dyneval ('RESULT = $<<$ARGS[1]>>_classes[i]')
  319. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_optional_weekly_grade_gain'']'
  320. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_optional_weekly_grade_gain''] = 0'
  321. 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'']'):
  322. 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''])'
  323. else
  324. 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''])'
  325. end
  326. if dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') > dyneval('RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade_cap'']'):
  327. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade_cap'']'
  328. end
  329. temp += dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']')
  330. n += 1
  331. dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] = 0'
  332. end
  333. i +=1
  334. if ARRSIZE('class_list_institution') > i: jump 'grade_loop1'
  335. if n > 0: dynamic 'class[''<<$ARGS[1]>>_grade_average''] = temp/n'
  336. killvar 'temp'
  337. killvar 'n'
  338. killvar 'i'
  339. end
  340. if $ARGS[0] = 'assing_grade_description':
  341. i=0
  342. :assing_grade_loop
  343. if $class_list_institution[i] = $ARGS[1]:
  344. if dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') < 10:
  345. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''1'' '
  346. elseif dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') < 20:
  347. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''2-'' '
  348. elseif dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') < 35:
  349. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''2'' '
  350. elseif dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') < 40:
  351. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''2+'' '
  352. elseif dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') < 50:
  353. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''3-'' '
  354. elseif dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') < 65:
  355. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''3'' '
  356. elseif dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') < 70:
  357. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''3+'' '
  358. elseif dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') < 75:
  359. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''4-'' '
  360. elseif dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') < 86:
  361. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''4'' '
  362. elseif dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') < 90:
  363. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''4+'' '
  364. elseif dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') < 92:
  365. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''5-'' '
  366. elseif dyneval( 'RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') < 97:
  367. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''5'' '
  368. else
  369. dynamic '$class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade''] = ''5+'' '
  370. end
  371. end
  372. i += 1
  373. if ARRSIZE('class_list_institution') >= i: jump 'assing_grade_loop'
  374. end
  375. if $ARGS[0] = 'grade above':
  376. !!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.
  377. dynamic 'class[''<<$ARGS[1]>>_grades_above_<<ARGS[2]>>''] = 0'
  378. i=0
  379. :grade_above_loop
  380. !!$i = dyneval ('RESULT = $<<$ARGS[1]>>_classes[i]')
  381. if $class_list_institution[i] = $ARGS[1]:
  382. if dyneval ('RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_grade'']') >= ARGS[2]:
  383. dynamic 'class[''<<$ARGS[1]>>_grades_above_<<ARGS[2]>>''] += 1'
  384. end
  385. end
  386. i +=1
  387. if ARRSIZE('class_list_institution') >= i: jump 'grade_above_loop'
  388. !!if dyneval ('RESULT = ARRSIZE(''<<$ARGS[1]>>_classes'')') >= i: jump 'grade_above_loop'
  389. end
  390. --- grades ---------------------------------