Quantcast

Jump to content

» «
Photo

Weird text string bug

3 replies to this topic
arielnmz
  • arielnmz

    BlackHawk

  • Members
  • Joined: 17 Jun 2011

#1

Posted 04 December 2013 - 07:21 PM

Hello everyone, this is the problem

 

I create a new formatted string and store it to 12@v like this:

0AD3: string 12@v format "obj_id_%d" OBJ_MODEL // Nombre de sección de ini

And if I store something into var 13@, the text is displayed like this:

obj_ -Ûi62

However, anywhere in the script before storing anything into 13@, the text is displayed/read correctly:

obj_id_362

Then I tried to use this:

0AC8: 12@ = allocate_memory_size 64

But I get the same results.

 

I hope you can help me... Thank you everyone!


DK22Pac
  • DK22Pac

    Playing SA on my lovely PS2. Y'all bums.

  • Feroci
  • Joined: 12 Apr 2009
  • Ukraine

#2

Posted 04 December 2013 - 07:37 PM

That's because 12@v variable will use 4 variables - 12@, 13@, 14@, 15@ to store the string.
So while you need text in 12@v, you must not touch these variables.

arielnmz
  • arielnmz

    BlackHawk

  • Members
  • Joined: 17 Jun 2011

#3

Posted 04 December 2013 - 08:16 PM

Ok, so you say locals are stored into contiguous addresses?? What if I allocate 32 bytes on 33@?? Thanks!


Silent
  • Silent

    Moderating Cookie Monster

  • Feroci
  • Joined: 01 Feb 2010
  • Poland
  • Most Helpful [GTA] 2013
    Most Helpful [Modding] 2013
    Most Talented [Modding] 2013
    Best Map 2013 "ViceCityStories PC Edition"
    Best Vehicle 2013 "III Aircraft"
    Most Helpful [Modding] 2012
    Modder of the Year 2012

#4

Posted 04 December 2013 - 09:14 PM

If you want to use CLEO4 opcodes with allocated memory, just refer to regular variables, and not longstrings. In your case, use 12@ in sprintf (after you've called memory alloc, storing the memory pointer to this var).




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users