The part below was added by me:
[shcode=cpp]
for 29@ = 0 to 8
call @GetIDbyIndex 1 29@ _ret 14@
if or
003B: 15@ == 14@
0039: 15@ == 1240
then
0342: set_text_draw_centered 1
081C: draw_text_outline 1 RGBA 0 0 0 255
033F: set_text_draw_letter_size 0.3 1.0
0340: set_text_draw_RGBA 0 255 0 255
045A: draw_text_1number 4@ 5@ GXT 'NUMBER' number 15@ // ~1~
end
end
:GetIDbyIndex //3013 && 3016 && 1252 && 1310 && 1252 && 1550 && 1575 && 1650 && 1279 && 2058
if 0@ == 0
then
31@ = 3013
end
if 0@ == 1
then
31@ = 3016
end
if 0@ == 2
then
31@ = 1252
end
if 0@ == 3
then
31@ = 1310
end
if 0@ == 4
then
31@ = 1550
end
if 0@ == 5
then
31@ = 1575
end
if 0@ == 6
then
31@ = 1650
end
if 0@ == 7
then
31@ = 1279
end
if 0@ == 8
then
31@ = 2058
end
ret 1 31@
[/shcode] It was added after the "for 14@" loop
From what I've seen you posted 9 different IDs in the following line:
[shcode=cpp]3013 && 3016 && 1252 && 1310 && 1252 && 1550 && 1575 && 1650 && 1279 && 2058[/shcode]
So the loop iterates 9 times, from 0 to 8. The following line is responsible for that
[shcode=cpp]for 29@ = 0 to 8[/shcode]
If you wanted to add more IDs you'd have to edit that line and make it into something like:
[shcode=cpp]for 29@ = 0 to 15[/shcode]
The function that is responsible for returning the ID is called "GetIDbyIndex". It is called 9 times within the loop, and each time it passes different number to it. Starting at 0 (which will return the first ID - 3013) and ending at 8 (which will return the last ID - 2058).
If you take a look at the following part of the "GetIDbyIndex" you'll see how it is done:
[shcode=cpp]
if 0@ == 0
then
31@ = 3013
end
[/shcode]
0@ is a variable that holds a parameter which was passed to the function (the number between 0 and 8 because that's how many IDs there are), if it is equal to 0 then the variable 31@ is set to the first ID.
Later this variable is returned back to the script where the function was called (14@ becomes 3013).
[shcode=cpp]ret 1 31@[/shcode]
[shcode=cpp]call @GetIDbyIndex 1 29@ _ret 14@[/shcode]
If you wanted to make a script which checks for 2 IDs instead of 9 then the part which was added after the "for 14@" loop would look like this:
[shcode=cpp]for 29@ = 0 to 1
call @GetIDbyIndex 1 29@ _ret 14@
if or
003B: 15@ == 14@
0039: 15@ == 1240
then
0342: set_text_draw_centered 1
081C: draw_text_outline 1 RGBA 0 0 0 255
033F: set_text_draw_letter_size 0.3 1.0
0340: set_text_draw_RGBA 0 255 0 255
045A: draw_text_1number 4@ 5@ GXT 'NUMBER' number 15@ // ~1~
end
end
:GetIDbyIndex
if 0@ == 0
then
31@ = 3013
end
if 0@ == 1
then
31@ = 3016
end
ret 1 31@[/shcode]
Shit, my bad... I didn't notice the variable 29@ was already used, changing it to 28@ fixed the issue, I also made mistake by placing the "GetIDbyIndex" function definition right under the "for 28@" loop, it should be at the end or after some "jump" instruction... Here's the fixed code:
Code:
// This file was decompiled using SASCM.ini published by GTAG (http://gtag.gtagaming.com/opcode-database) on 14.6.2013
{$CLEO .cs}
//-------------MAIN---------------
0000: NOP
03F0: enable_text_draw 1
wait 5000
13@ = 0
:Noname_11
wait 0
if and
0AB0: 75
0AB0: 51
then
if 13@ == 1
then
13@ = 0
else
13@ = 1
end
wait 500
end
if and
Player.Defined($PLAYER_ACTOR)
13@ == 1
else_jump @Noname_257
0A8D: 29@ = read_memory 12010652 size 4 virtual_protect 0
29@ += 4
0A8D: 29@ = read_memory 29@ size 4 virtual_protect 0
30@ = 0
:Noname_71
0A8D: 31@ = read_memory 29@ size 1 virtual_protect 0
29@ += 1
if and
31@ >= 0
128 > 31@
else_jump @Noname_232
005A: 31@ += 30@ // (int)
15@ = Object.Model(31@)
Object.StorePos(31@, 1@, 2@, 3@)
call @Noname_264 3 1@ 2@ 3@ 4@ 5@
for 14@ = 321 to 397 step 1
if or
003B: 15@ == 14@
0039: 15@ == 1240
then
0342: set_text_draw_centered 1
081C: draw_text_outline 1 RGBA 0 0 0 255
033F: set_text_draw_letter_size 0.3 1.0
0340: set_text_draw_RGBA 0 255 0 255
045A: draw_text_1number 4@ 5@ GXT 'NUMBER' number 15@ // ~1~
end
end
for 28@ = 0 to 8
call @GetIDbyIndex 1 28@ _ret 14@
if or
003B: 15@ == 14@
0039: 15@ == 1240
then
0342: set_text_draw_centered 1
081C: draw_text_outline 1 RGBA 0 0 0 255
033F: set_text_draw_letter_size 0.3 1.0
0340: set_text_draw_RGBA 0 255 0 255
045A: draw_text_1number 4@ 5@ GXT 'NUMBER' number 15@ // ~1~
end
end
:Noname_232
30@ += 256
30@ > 89344
else_jump @Noname_71
:Noname_257
jump @Noname_11
:Noname_264
0AA7: call_function 7392816 num_params 6 pop 6 1 1 7@s 6@s 2@s 0@s 29@
0073: 2@ /= 6@ // (float)
0073: 2@ /= 4@ // (float)
0073: 3@ /= 7@ // (float)
0073: 3@ /= 4@ // (float)
2@ *= 640.0
3@ *= 448.0
ret 2 2@ 3@
:GetIDbyIndex //3013 && 3016 && 1252 && 1310 && 1252 && 1550 && 1575 && 1650 && 1279 && 2058
if 0@ == 0
then
31@ = 3013
end
if 0@ == 1
then
31@ = 3016
end
if 0@ == 2
then
31@ = 1252
end
if 0@ == 3
then
31@ = 1310
end
if 0@ == 4
then
31@ = 1550
end
if 0@ == 5
then
31@ = 1575
end
if 0@ == 6
then
31@ = 1650
end
if 0@ == 7
then
31@ = 1279
end
if 0@ == 8
then
31@ = 2058
end
ret 1 31@
I tested activating it and it didn't crash but I didn't test whether it actually works