You are not logged in.
Pages: 1
I tried to use opcode 06D2 and when i use it the compilations is giving me the error "Nielegalna litera w etykiecie @v." My translate: "Illegal letter in etiquete @v."
it's the whole line:
06D2: VMUSIC_NAME[1] = "CLEO\playlist\01.mp3" // v$ = string
earlier in const
VMUSIC_NAME = 0@v
Please help me because it's not working! If use the opcode 06D1 and global variable it is compiled but nothing happens in game...
I'm using CLEO 3
Offline
Length of your text is more than 16 letters...
Offline
You are very wrong i just not noticed that local variables dont have arrays 0@[1] just 1@, 2@
Offline
Arrays are in the same places, so 0@[0] is 0@, 0@[1] is 1@...
Sorry, s$ is 16 byte long, v$ have variable size...
The same expression works with global variable!
Offline
Local variables can not use arrays of that type. To use arrays you would need a var..end structure and define the type, or so I've been told (see Sanny's Arrays page in the help documentation).
Use arrays like this:
30@ = 0 // index
06D2: 0@(30@,16v) = "CLEO\playlist\01.mp3"
{
0@ == "CLEO"
1@ == "\pla"
2@ == "ylis"
}
{
30@ = 0
0@(30@,16v) == "CLEO"
30@ = 1
0@(30@,16v) == "\pla"
}etc.
Offline
Sorry Deji, but i don't understand you and i used global variables...
But it's still crashing, could you point me where I'm wrong?
{$VERSION 3.1.0027}
{$CLEO .cs}
//-------------MAIN---------------
thread 'iPox2'
054C: use_GXT_table 'IPOX'
const
ROW = 31@
VMUSIC_NAME = v$MN
TEMP = 21@
end
06D1: VMUSIC_NAME[1] = "CLEO\playlist\01.mp3" // v$ = string
06D1: VMUSIC_NAME[2] = "CLEO\playlist\02.mp3" // v$ = string
06D1: VMUSIC_NAME[3] = "CLEO\playlist\03.mp3" // v$ = string
06D1: VMUSIC_NAME[4] = "CLEO\playlist\04.mp3" // v$ = string
06D1: VMUSIC_NAME[5] = "CLEO\playlist\05.mp3" // v$ = string
06D1: VMUSIC_NAME[6] = "CLEO\playlist\06.mp3" // v$ = string
06D1: VMUSIC_NAME[7] = "CLEO\playlist\07.mp3" // v$ = string
06D1: VMUSIC_NAME[8] = "CLEO\playlist\08.mp3" // v$ = string
06D1: VMUSIC_NAME[9] = "CLEO\playlist\09.mp3" // v$ = string
06D1: VMUSIC_NAME[10] = "CLEO\playlist\10.mp3" // v$ = string
06D1: VMUSIC_NAME[11] = "CLEO\playlist\11.mp3" // v$ = string
06D1: VMUSIC_NAME[12] = "CLEO\playlist\12.mp3" // v$ = string
06D1: VMUSIC_NAME[13] = "CLEO\playlist\13.mp3" // v$ = string
06D1: VMUSIC_NAME[14] = "CLEO\playlist\14.mp3" // v$ = string
06D1: VMUSIC_NAME[15] = "CLEO\playlist\15.mp3" // v$ = string
06D1: VMUSIC_NAME[16] = "CLEO\playlist\16.mp3" // v$ = string
06D1: VMUSIC_NAME[17] = "CLEO\playlist\17.mp3" // v$ = string
06D1: VMUSIC_NAME[18] = "CLEO\playlist\18.mp3" // v$ = string
06D1: VMUSIC_NAME[19] = "CLEO\playlist\19.mp3" // v$ = string
06D1: VMUSIC_NAME[20] = "CLEO\playlist\20.mp3" // v$ = string
:load
for TEMP = 1 to 20
wait 10
if
0AAB: file_exists $MN(TEMP,20v)
then
wait 10
0AAC: $MN(TEMP,20i) = load_mp3 $MN(TEMP,20v)
else
$MN(TEMP,20i) = -1
end
end
:IP1
wait 10
if
Player.Defined($PLAYER_CHAR)
jf @IP1
wait 10
if
0AB0: key_pressed 106
jf @IP1
jump @IP2a
:IP2a
for TEMP = 1 to 20
0AB9: get_mp3 $MN(TEMP,20i) state_to 30@
wait 10
if
not 30@ == 0
then
jump @IP2b
end
end
Player.CanMove($PLAYER_CHAR) = False
08D4: $Panel = create_panel_with_title 'TYT' position 29.0 145.0 width 200.0 columns 1 interve 1 background 1 alignment 1
08DB: set_panel $Panel column 0 header '0' data 'MUZYKA' 'MUZ2' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY'
08EE: set_panel $Panel column 0 row 2 text_1number GXT 'NIC' number 0 // $~1~
jump @czekaj_na_wybor
:IP2b
for TEMP = 1 to 20
0AB9: get_mp3 $MN(TEMP,20i) state_to 30@
wait 10
if
30@ == 1
then
Player.CanMove($PLAYER_CHAR) = False
08D4: $Panel = create_panel_with_title 'TYT' position 29.0 145.0 width 200.0 columns 1 interve 1 background 1 alignment 1
08DB: set_panel $Panel column 0 header '0' data 'MUZYKA' 'MUZ2' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY'
08EE: set_panel $Panel column 0 row 2 text_1number GXT 'PS' number 0 // $~1~
jump @czekaj_na_wybor
end
end
:IP2c
for TEMP = 1 to 20
0AB9: get_mp3 $MN(TEMP,20i) state_to 30@
wait 10
if
30@ == 2
then
Player.CanMove($PLAYER_CHAR) = False
08D4: $Panel = create_panel_with_title 'TYT' position 29.0 145.0 width 200.0 columns 1 interve 1 background 1 alignment 1
08DB: set_panel $Panel column 0 header '0' data 'MUZYKA' 'MUZ2' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY'
08EE: set_panel $Panel column 0 row 2 text_1number GXT 'PL' number 0 // $~1~
jump @czekaj_na_wybor
end
end
:czekaj_na_wybor
wait 0
if
00E1: player $PLAYER_CHAR pressed_key 15
jf @czekaj_na_wybor_test2
08DA: remove_panel $Panel
Player.CanMove($PLAYER_CHAR) = True
:czekaj_na_wybor_test2
if
00E1: player $PLAYER_CHAR pressed_key 16
jf @czekaj_na_wybor
08D7: $Wybrane = panel $Panel active_row
08DA: remove_panel $Panel
0871: init_jump_table $Wybrane total_jumps 1 -1 -1 jumps 0 @kolejno 1 @nic 2 @nic -1 -1 -1 -1 -1 -1 -1 -1
:kolejno
jump @IP1
:nic
jump @IP1
Offline
Maybe globals making crash...
Offline
Sorry Deji, but i don't understand you and i used global variables...
But it's still crashing, could you point me where I'm wrong?
Don't use globals in cleo!
it can cause bugs and crashs
Fourthermore the mp3 funktion of cleo 3 is not stable at all.
Seemann recomand to load and play only one mp3 and unload it first to can load the next one.
use opcodes 0AAD and 0AAE
{$CLEO .cs}
:Music_mp3
thread 'Music'
:Music_1
wait 0
1@ = -1
if
0AB0: key_pressed 8//-------press Backspace key
jf @Music_1
0AAC: 1@ = load_mp3 "CLEO\music\track.mp3"
if
8039: NOT 1@ == -1
jf @Music_1
0AAD: set_mp3 1@ perform_action 1
wait 250000
0AAD: set_mp3 1@ perform_action 0
wait 0
0AAE: release_mp3 1@
jump @Music_1
Offline
Yes I written that in this mod version 1.0 and later (1.2) but when i used it in SAMP, when music were changing it was making big lags. So i thought about loading it at start. I got enough RAM i think... And i need twenty slots. Could you help me with those arrays?
Offline
Yes I written that in this mod version 1.0 and later (1.2) but when i used it in SAMP, when music were changing it was making big lags. So i thought about loading it at start. I got enough RAM i think... And i need twenty slots. Could you help me with those arrays?
Hmmm...difficult and complex because we must use locals in cleo and a local can contain max 2 byte but we need 16 byte for the 16 byte string.
------------------------------------------------------------------------------------
Ok, first let explain how to use local arrays
As you know is an array construct like a family with childs
and the Index of the Family defines which part of the family is meant
Family[index 0] = father
Family[index 1] = mother
Family[index 2] = son
Family[index 3] = doughter
Family[index 4] = Carl
Family[index 1] goes in the kitchen
means:
mother goes in the kitchen
Lets go to GTA and local variables
We can use the same variable in the array construct
but we [large]must reserve more local variables[/large]
6@[index 0] = father
6@[index 1] = mother
6@[index 2] = son
6@[index 3] = doughter
6@[index 4] = Carl
[large]the assignment of ascending index values uses new locals in ascending order[/large]
6@ = father
7@ = mother
8@ = son
9@ = doughter
10@ = Carl
the array construct:
6@(30@,5i)
30@ is the array index
example:
we define the value of the index:
0006: 30@ = 4
now
6@(30@,5i) goes in the kitchen
means
Carl goes in the kitchen
its the same like:
10@ goes in the kitchen
6@, 7@, 8@, 9@, 10@ can't be used for other function in the script
6@, 7@, 8@, 9@, 10@ must be reserve for the arrays
example:
after each pickup spawn we add 1 to the array index
000A: 30@ += 1
{$CLEO .cs}
:Array_items1
03A4: name_thread 'Array_1'
0006: 6@ = 1239 // info
0006: 7@ = 1240 // health
0006: 8@ = 1241 // adrenaline
0006: 9@ = 1242 // bodyarmour
0006: 10@ = 1247 //bribe
0006: 30@ = 0 // ---Array Index is 0
0213: 0@ = create_pickup 6@(30@,5i) type 15 at 2490.0 -1662.0 13.5
000A: 30@ += 1// ---Array Index is 1
0213: 1@ = create_pickup 6@(30@,5i) type 15 at 2492.0 -1662.0 13.5
000A: 30@ += 1// ---Array Index is 2
0213: 2@ = create_pickup 6@(30@,5i) type 15 at 2494.0 -1662.0 13.5
000A: 30@ += 1// ---Array Index is 3
0213: 3@ = create_pickup 6@(30@,5i) type 15 at 2496.0 -1662.0 13.5
000A: 30@ += 1// ---Array Index is 4
0213: 4@ = create_pickup 6@(30@,5i) type 15 at 2498.0 -1662.0 13.5
0A93: end_custom_thread------------------------------------------------------------------------------------
Next problem: a 16 byte string can contain max 10 charackter
It needs to use the method which Deji showed above
Or reduce the content of the string
So place your playlist folder in the game root directory and rename the folder to a shorter name
For following examples I placed the files in GTASA\P
0AAB: file_exists "P\01.MP3"
the script could look now in this kind
{$CLEO .cs}
//-------------MAIN---------------
03A4: name_thread 'PLAYLIST'
0001: wait 1000 ms
06D2: 0@v = "P\01.MP3" // @v = string
06D2: 4@v = "P\02.MP3" // @v = string
06D2: 8@v = "P\03.MP3" // @v = string
06D2: 12@v = "P\04.MP3" // @v = string
06D2: 16@v = "P\05.MP3" // @v = string
0006: 31@ = 0
:PLAYLIST_106
0001: wait 0 ms
00D6: if
0256: player $PLAYER_CHAR defined
004D: jump_if_false @PLAYLIST_106
0006: 30@ = -1
00D6: if
0AB0: key_pressed 8
004D: jump_if_false @PLAYLIST_106
00D6: if
0AAB: file_exists 0@(31@,16v)
004D: jump_if_false @PLAYLIST_106
0AAC: 30@ = load_mp3 0@(31@,16v)
00D6: if
8039: not 30@ == -1
004D: jump_if_false @PLAYLIST_106
0AAD: set_mp3 30@ perform_action 1
0001: wait 1000 ms
:PLAYLIST_210
0001: wait 0 ms
00D6: if
0256: player $PLAYER_CHAR defined
004D: jump_if_false @PLAYLIST_245
00D6: if
0AB0: key_pressed 8
004D: jump_if_false @PLAYLIST_210
:PLAYLIST_245
0AAD: set_mp3 30@ perform_action 0
0001: wait 0 ms
0AAE: release_mp3 30@
000A: 31@ += 4
0002: jump @PLAYLIST_106But you will see that it only plays 0@v and 16@v
It's not possible with a CS file to shift more than 2 filepaths into arrays
It requires a missionscript *.CM which allows to use 1000 locals
------------------------------------------------------------------------------------
The missionscript *.CM is the only way to realize your plan in a stable way
the mission starter script
{$CLEO .cs}
03A4: name_thread 'MSTART'
wait 3000
:M_Start_2
0001: wait 0 ms
00D6: if 0
0256: player $PLAYER_CHAR defined
004D: jump_if_false @M_Start_2
00D6: if 0
0038: $ONMISSION == 0 // integer values
004D: jump_if_false @M_Start_2
00BA: text_styled 'fem_on' 1000 ms 4
0001: wait 500 ms
0004: $ONMISSION = 1 // integer values
0A94: start_custom_mission "mp3_playlist"
0001: wait 500 ms
0002: jump @M_Start_2The missionscript *.CM must be compiled as [large]mp3_playlist.cm[/large]
like the entry of opcode 0A94: in the starter script
{$CLEO .cm}
thread 'PLAYLIST'
0050: gosub @PlayMPlist_main_1
0AAD: set_mp3 500@ perform_action 0
wait 0
0AAE: release_mp3 500@
0004: $ONMISSION = 0
004E: end_thread
:PlayMPlist_main_1
06D2: 50@v = "P\01.MP3" // @v = string
06D2: 66@v = "P\02.MP3" // @v = string
06D2: 82@v = "P\03.MP3" // @v = string
06D2: 98@v = "P\04.MP3" // @v = string
06D2: 114@v = "P\05.MP3" // @v = string
06D2: 130@v = "P\06.MP3" // @v = string
06D2: 146@v = "P\07.MP3" // @v = string
06D2: 162@v = "P\08.MP3" // @v = string
06D2: 178@v = "P\09.MP3" // @v = string
06D2: 194@v = "P\10.MP3" // @v = string
555@ = 0
:PlayMPlist_11
wait 0
500@ = -1
if
0AB0: key_pressed 8//-- backspace
jf @PlayMPlist_11
if
0AAB: file_exists 50@(555@,16v)
jf @PlayMPlist_11
0AAC: 500@ = load_mp3 50@(555@,16v)
if
not 500@ == -1
jf @PlayMPlist_11
0AAD: set_mp3 500@ perform_action 1
wait 1000
:PlayMPlist_184
wait 0
if
0AB0: key_pressed 8//-- backspace
jf @PlayMPlist_184
:PlayMPlist_252
0AAD: set_mp3 500@ perform_action 0
wait 0
0AAE: release_mp3 500@
555@ += 4
if
555@ > 36
jf @PlayMPlist_11
555@ = 0
jump @PlayMPlist_11the array index must be increased by 4 to submit the next array content
------------------------------------------------------------------------------------
Fazit:
To shift file name paths into arrays makes no sense
You can use a very easy method to select the mp3 files
With jumptable for example:
{$CLEO .cs}
//-------------MAIN---------------
03A4: name_thread 'PLAYLIST'
0001: wait 1000 ms
0006: 31@ = 0
:PLAYLIST_106
0001: wait 0 ms
00D6: if
0256: player $PLAYER_CHAR defined
004D: jump_if_false @PLAYLIST_106
0006: 30@ = -1
00D6: if
0AB0: key_pressed 8
004D: jump_if_false @PLAYLIST_106
0050: gosub @PLAYLIST_Jumptable
00D6: if
0AAB: file_exists 0@v
004D: jump_if_false @PLAYLIST_106
0AAC: 30@ = load_mp3 0@v
00D6: if
8039: not 30@ == -1
004D: jump_if_false @PLAYLIST_106
0AAD: set_mp3 30@ perform_action 1
0001: wait 1000 ms
:PLAYLIST_210
0001: wait 0 ms
00D6: if
0256: player $PLAYER_CHAR defined
004D: jump_if_false @PLAYLIST_245
00D6: if
0AB0: key_pressed 8
004D: jump_if_false @PLAYLIST_210
:PLAYLIST_245
0AAD: set_mp3 30@ perform_action 0
0001: wait 0 ms
0AAE: release_mp3 30@
000A: 31@ += 1
if
31@ > 9
jf @PLAYLIST_106
31@ = 0
0002: jump @PLAYLIST_106
:PLAYLIST_Jumptable
0871: init_jump_table 31@ total_jumps 11 0 @MPJUMP_00 jumps 0 @MPJUMP_01 1 @MPJUMP_11 2 @MPJUMP_22 3 @MPJUMP_33 4 @MPJUMP_44 5 @MPJUMP_55 6 @MPJUMP_66
0872: jump_table_jumps 7 @MPJUMP_77 8 @MPJUMP_88 9 @MPJUMP_99 -1 @MPJUMP_00 -1 @MPJUMP_00 -1 @MPJUMP_00 -1 @MPJUMP_00 -1 @MPJUMP_00 -1 @MPJUMP_00
:MPJUMP_00
06D2: 0@v = "P\01.MP3" // @v = string
0002: jump @MPJUMP_end
:MPJUMP_01
06D2: 0@v = "P\01.MP3" // @v = string
0002: jump @MPJUMP_end
:MPJUMP_11
06D2: 0@v = "P\02.MP3" // @v = string
0002: jump @MPJUMP_end
:MPJUMP_22
06D2: 0@v = "P\03.MP3" // @v = string
0002: jump @MPJUMP_end
:MPJUMP_33
06D2: 0@v = "P\04.MP3" // @v = string
0002: jump @MPJUMP_end
:MPJUMP_44
06D2: 0@v = "P\05.MP3" // @v = string
0002: jump @MPJUMP_end
:MPJUMP_55
06D2: 0@v = "P\06.MP3" // @v = string
0002: jump @MPJUMP_end
:MPJUMP_66
06D2: 0@v = "P\07.MP3" // @v = string
0002: jump @MPJUMP_end
:MPJUMP_77
06D2: 0@v = "P\08.MP3" // @v = string
0002: jump @MPJUMP_end
:MPJUMP_88
06D2: 0@v = "P\09.MP3" // @v = string
0002: jump @MPJUMP_end
:MPJUMP_99
06D2: 0@v = "P\10.MP3" // @v = string
0002: jump @MPJUMP_end
:MPJUMP_end
0051: return
Offline
Very, very thank you ZAZ, you really helped me.
Offline
Pages: 1