piotre_94 Posted June 30, 2009 Share Posted June 30, 2009 Hello everybody! I have a problem with my first cleo mod can you help me pleaze, the game crash just after press key 17. This line thread @BARRIL_3 is the problem but i don't find a another way thread "BARRIL_1" :BARRIL_1 wait 0 ms if Player.Defined($PLAYER_CHAR)else_jump @BARRIL_1 00D6: if 1 00E1: key pressed 0 17 00DF: actor $PLAYER_ACTOR driving 004D: jump_if_false @BARRIL_1 03C0: [email protected] = actor $PLAYER_ACTOR car 0407: create coordinate [email protected] [email protected] [email protected] from car [email protected] offset 0.0 -2.5 1.0 0174: [email protected] = car [email protected] z_angle 0009: [email protected] += 90.0// floating-point values 02CE: [email protected] = ground z [email protected] [email protected] [email protected] 000B: [email protected] += 0.1 Model.Load(1225) thread @BARRIL_3:BARRIL_303A4: name thread "BARREL":BARRIL_4wait 10 msif Model.Available(1225) 004D: jump_if_false @BARRIL_4 0004: [email protected] = 0 // integer values [email protected] = Object.Create(1225, [email protected], [email protected], [email protected]) 0177: set object [email protected] z angle to [email protected] 01C7: remove_object_from_mission_cleanup_list [email protected] 0007: [email protected] = [email protected] 000F: [email protected] -= 2.0 000B: [email protected] += 2.0 0007: [email protected] = [email protected] 000F: [email protected] -= 2.0 000B: [email protected] += 2.0 :BARRIL_50001: wait 250 ms 00D6: if 0 0019: [email protected] > 15000 004D: jump_if_false @BARRIL_5 0249: release_model 1225 0108: destroy object [email protected] 0002: jump @BARRIL_10459: end_thread_named 'BARRIL' my mod works with BW's but not with Cléo Link to comment Share on other sites More sharing options...
PatrickW Posted June 30, 2009 Share Posted June 30, 2009 It looks like you either took your inspiration from the Stinger-drop mod that I made for VC, or from the SA conversion of that mod, made by demonj0e. Since most of your code seems to be a carbon-copy of that code. A couple of months ago I released a CLEO version of it for SA. In addition to the Stinger-Drop mod, I've used this same construction also for a Mine-drop mod. You've seem to have messed up the overall structure. The idea is that there are two threads: a sniffer thread that is normally running, and checks whether the player is in a car and presses a button. If he does, a thread is created, that creates the object, and monitors it, after a specified amount of time, the object is removed and the thread is ended. Of these object-threads several can exist in parallel. One for each of the objects dropped. The problem with making it in a CLEO, is that you can't create multiple threads very well, that's why in my CLEO implementations, there are two files, one for the sniffer-thread and one for the object-threads. Link to comment Share on other sites More sharing options...
piotre_94 Posted June 30, 2009 Author Share Posted June 30, 2009 Thank you ! I just finish my cleo mod with your help If it can interest someone I post it create a file "barril.txt" {$VERSION 3.1.0027}{$CLEO .s}:BARRIL_thread0004: [email protected] = 0 [email protected] = Object.Create(1225, [email protected], [email protected], [email protected]) 0177: set object [email protected] z angle to [email protected] 01C7: remove_object_from_mission_cleanup_list [email protected] 0007: [email protected] = [email protected] 000F: [email protected] -= 2.0 000B: [email protected] += 2.0 0007: [email protected] = [email protected] 000F: [email protected] -= 2.0 000B: [email protected] += 2.0 repeat wait 250until [email protected] > 15000 0249: release_model 1225 0108: destroy object [email protected]: end_custom_thread and create a new one "barril_drop.txt" {$VERSION 3.1.0027}{$CLEO .cs}thread "BARRIL_1":BARRIL_1 03A4: name thread "BARRIL" :BARRIL_2 wait 0 ms if Player.Defined($PLAYER_CHAR)else_jump @BARRIL_2 00D6: if 1 00E1: key pressed 0 17 00DF: actor $PLAYER_ACTOR driving 004D: jump_if_false @BARRIL_2 03C0: [email protected] = actor $PLAYER_ACTOR car 0407: create coordinate [email protected] [email protected] [email protected] from car [email protected] offset 0.0 -2.5 1.0 0174: [email protected] = car [email protected] z_angle 0009: [email protected] += 90.0// floating-point values 02CE: [email protected] = ground z [email protected] [email protected] [email protected] 000B: [email protected] += 0.10A92: create_custom_thread "barril.s" [email protected] [email protected] [email protected] [email protected] 250 ms 0002: jump @BARRIL_2 Then compile and have fun Link to comment Share on other sites More sharing options...
KyanoAng3l0 Posted June 30, 2009 Share Posted June 30, 2009 (edited) It looks like you either took your inspiration from the Stinger-drop mod that I made for VC, or from the SA conversion of that mod, made by demonj0e. Since most of your code seems to be a carbon-copy of that code. OR he thought of it by himself, having no knowledge about the existence of another mod of the same concept. Yeah it looks like a carbon copy mainly because there's no other or alternate way of coding it, is there? You can't really immediately blame that he/she's ripping or taking ideas because it could be true that he/she thought of it himself/herself or thought of it the same way as you did when you made and released your own mod of the same/similar concept. But as a modder, I learned that before releasing a mod I should make sure that there's no other mod of the same concept already released and uploaded, otherwise I would be blamed for ripping. To be honest, back then, the word "ripping" doesn't exist or doesnt' apply in the modding world as long as both mods are in the same language and are for the same game. Nice Stinger-drop mod though. Too bad very single key available is used by the superpower mods I've installed/made. Edited June 30, 2009 by angeloelibz24 Link to comment Share on other sites More sharing options...
Dutchy3010 Posted June 30, 2009 Share Posted June 30, 2009 My god... The only thing he said, is that he thinks that the topic creator used the code of others and messed it up. Is that blaming for ripping? No... He haven't said a thing about ripping or about "theft". He only said that it looks like the code of others, but that it is messed up. He provided a link so he could compare them if he wanted to. Nobody said a damn thing about ripping or theft, so your offtopic post is useless. Ontopic now. DYOM - Create, play, share! Link to comment Share on other sites More sharing options...
PatrickW Posted June 30, 2009 Share Posted June 30, 2009 (edited) Thank you ! I just finish my cleo mod with your help No problem Adapting existing code (be it original or other peoples code) is an excellent way to learn SCM coding. You should how ever be careful, that if you want to release it as an Mod you should ask permission of the original author, if you're re-using a lot of his/her code. (Should you want to release this, you have my permission, credits would be appreciated however) The code looks good, and the idea of dropping barrels sound like fun. In the berril.txt file you could have removed a bit more of the existing code, as much of it is not needed in your mod. {$VERSION 3.1.0027}{$CLEO .s}:BARRIL_thread0004: [email protected] = 0 [email protected] = Object.Create(1225, [email protected], [email protected], [email protected]) 0177: set object [email protected] z angle to [email protected] 01C7: remove_object_from_mission_cleanup_list [email protected] wait 15000 0249: release_model 1225 0108: destroy object [email protected]: end_custom_thread @angeloelibz24: I didn't accuse him of ripping, I just pointed out that he copied most of his code from my mod, but I've got no problem with that in this case. And yes, he could have though about it myself, but there are so many ways to do it and to choose your constant that it would be very coincidental, that he came up with this code all by himself. Especially since a multi-threaded solution, is not the first thing people that just started modding think about. If you want to discuss this further, send me a PM, as I don't want to mess up this topic. Edited June 30, 2009 by PatrickW Link to comment Share on other sites More sharing options...
piotre_94 Posted June 30, 2009 Author Share Posted June 30, 2009 I didn't know a similair code already exist. And if I had known this before, I didn't work on it during 2 days. Now I'm looking for an opcode like: 04F7: status_text $10949 0 line 1 'NNNNNN' but I don't want to use a "$" variable for my cleo mod How can i do that for cleo? I try to convert an another code I make before on BW's Link to comment Share on other sites More sharing options...
gtasearcher Posted June 30, 2009 Share Posted June 30, 2009 A "$" is the denotion of a global variable. Global variables shouldn't be used in CLEO [other than $PLAYER_ACTOR, $PLAYER_CHAR, $ONMISSION] because they can interfere with main.scm ones; in rest, they're almost the same as locals, but they can be used to communicate in multiple threads. You can replace any global with a local [@]. BUT BE CAREFUL. Things like text status and timers need globals, in 04F7: status_text $10949 0 line 1 'NNNNNN' you should think of an unesed global in the main.scm, and use it instead of $10949, like $CLEO_VARIABLE_USED_FOR_TEXT_STATUS Link to comment Share on other sites More sharing options...
piotre_94 Posted June 30, 2009 Author Share Posted June 30, 2009 If I create a new global variable like : $CLEO_VARIABLE_USED_FOR_TEXT_STATUS. I'm not sur i can load the game after save without crash Does it really works? Link to comment Share on other sites More sharing options...
gtasearcher Posted June 30, 2009 Share Posted June 30, 2009 If I create a new global variable like : $CLEO_VARIABLE_USED_FOR_TEXT_STATUS.I'm not sur i can load the game after save without crash Does it really works? If you put it in a CLEO, yes Link to comment Share on other sites More sharing options...
PatrickW Posted June 30, 2009 Share Posted June 30, 2009 I don't think that it is safe to just use a newly invented Global variable name. Sannybuilder will have to map that onto a memory location in the Global variable storage and it's very likely (maybe even certain) that the same location is already occupied by one of the global variables in the main.scm. Depending on which global this is in the main.scm, the results can vary between crashes or minor changes in behavior. The only variables that are safe to be used in a CLEO mods, are the ones that are defined in the Customvariables.ini file. As that file fixates the mapping between a Global Variable name and it's memorylocation. But these all have a predefined meaning, so they aren't useful in this situation. If you must use an Global in a CLEO scripts (certain opcodes require one), a safe option is to use a named variable from the Customvariables.ini file, that isn't actually used in the main.scm. (e.g. $SECOND_PLAYER). Another option might be to use the numerical name of one of the unused globals. e.g. $707 (numerical names have an implicit mapping onto a memory location). Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now