Jump to content

» «

(SA) Modifying main.scm: Problem with large global arrays

No replies to this topic
  • Sloth-

    Being meguca is suffering

  • Members
  • Joined: 01 Aug 2012
  • Venezuela


Posted 15 June 2014 - 12:10 AM



My current problem is as follows:


When i declare large arrays (strings) in global variables, at least 1000 elements, the structure result damaged, or enters in conflict with other data stored in global variables. But when i try to reduce the elements, to 84 max, the problem is solved temporally. But then i continue writing code, the file grows, i declare and use more variables, and, my 84-elements arrays get corrupted.




No one warned about something like this in coding tutorials, and i NEED to manage large arrays of data in order to simplify my program. I guess no one expected to write a main.scm as complex as mine (currently i am exporting A LOT of code from original main, like taxy-ambulan-firefighter missions, videogame missions, external scripts to manage gyms, ped animations inside bars, restaurants, striptease clubs, casinos, and more stuff).


I would like to show the exact part of my code that is failing, but it has grown a lot. Basically, the string arrays has skin names to replace my player character, that i obtain from an added *.img file by my own, and i know the data inside the elemnts is corrupted because when the code executes the opcode 09C7: change_player $PLAYER_CHAR model_to, then the game crashes.


If someone of you knows how to make a better and clean management of data, in order to avoid this kind of problems, i'll be really grateful with the information i guess i missed while i was learning, if not, i will have to sacrifice beautyness and shortness in my code in order to fix the thing.



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users