Advertisement
ZoriaRPG

std_vars.zh for ZC 2.55

Nov 25th, 2016
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.15 KB | None | 0 0
  1. //General-Use Arrays with Getter/Setter functions
  2. //13th February, 2016, 2016
  3.  
  4. //A generic array, pre-included with all quests.
  5. //float stdArray[4096]; //This should be called GlobalRAM[]
  6. int GlobalRAM[4096];
  7. int GlobalBugger[214747];
  8.  
  9. //! Because this is the first global array that will likely be declared, called from the 'import "std.zh"'
  10. //! directive in scripts, or from the buffer; as the import directive for std.zh is usually the very first
  11. //! instruction in any compilation attempt; this array will automatically have the highest numbered pointer.
  12. //! This means that if it is added after a quest is made, it will be unavailable for use in existing SAVES
  13. //! but it will not change the ordering of other arrays, or variables.
  14. //!
  15. //! Thus, running the quest on an old SAVE will NOT break anything, but it allows a quest developer who uses
  16. //! this feature FROM THE ONSET, before releasing a agme, to EASILY go back in, and add global values EVEN
  17. //! after releasing a quest, and with people playing it, WITHOUT invalidating their saved games; and it
  18. //! WILL allow them to use the new variables.
  19. //!
  20. //! It's essentially a catch-all for questmakers, as a way to later expand a quest, without breaking player
  21. //! save files, or requiring them to start from scratch, to play the update.
  22.  
  23.  
  24.  
  25. //Data Handling Functions
  26.  
  27. //Get the value of any 'index' in the generic array.
  28. float GetV(int index){
  29.     return GlobalRAM[index];
  30. }
  31.  
  32. //Set the value of any 'index', to a specific amount 'value'.
  33. void SetV(int index, int value){
  34.     GlobalRAM[index] = value;
  35. }
  36.  
  37. //Increase the value of any 'index' by +1.
  38. void IncV(int index) {
  39.     GlobalRAM[index]++;
  40. }
  41.  
  42. //Increase the value of any 'index' by 'amount'.
  43. void IncV(int index, int amount){
  44.     GlobalRAM[index] += amount;
  45. }
  46.  
  47. //Decrease the value of any 'index' by -1.
  48. void DecV(int index){
  49.     GlobalRAM[index]--;
  50. }
  51.  
  52. //Decrease the value of any 'index' by 'amount'.
  53. void DecV(int index, int amount){
  54.     GlobalRAM[index] -= amount;
  55. }
  56.  
  57. //Stores the pointer of any array to an inmdex of GlobalRAM to allow accessing it from any script.
  58. void StoreArrayPointer(int arr, int index){
  59.     GlobalRAM[index] = arr;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement