|
 |
|
|
|
|
|
GTA Modification Forums
Cleo Chidori Eisou help keeps on crashing
 |
|
 |
| |
The_Sorrow  |
|
Heaven, I'm in heaven(8)

Group: Members
Joined: May 31, 2010


|
I have no idea if this will work, Rarely do object based coding nevertheless I attempted to produce what I hope is the correct code:
| CODE | {$CLEO .cs} 0000:
:1 0247: load_model #KATANA 038B: load_requested_models
:Eisou_12 wait 0 if and 0248: model #KATANA available[/QUOTE] 0AB0: key_pressed 0x48 jf @1 01B2: give_actor $PLAYER_ACTOR weapon 8 ammo 1 // Load the weapon model before using this 04C4: store_coords_to $1 $2 $3 from_actor $PLAYER_ACTOR with_offset 0.0 0.0 0.0 0107: $KAT = create_object #KATANA at $1 $2 $3 0609A0: actor $PLAYER_ACTOR attach_object $KAT with_offset 0.0 0.0 0.0 on_bone 6 16 perform_animation "NULL" IFP_file "NULL" time 1 0750: set_object $KAT visibility 0 066E: create_particle "ELECTRICNAR" attached_to_object $KAT with_offset 0.1 0.0 0.0 rotation 90.0 0.0 90.0 flag 1 handle_as 1@(30@,1i) 064C: make_particle 1@(30@,1i) visible end_thread |
P.S - Yes i know I used global variables, Don't need another 'Coding wannabe' explaining to me how I shouldn't use them. That is in no way an offense to the people who actually understand coding!
| QUOTE | | SI I SUGGEST YOU LEARN CODING |
Dude, You don't even know coding, You cannot go around telling people to 'Learn coding' when you yourself needs to learn it plus you didn't even provide any links to tutorials and such
Tutorials: Go here for a bunch of coding tutorials This post has been edited by The_Sorrow on Monday, Apr 16 2012, 08:59
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
The_Sorrow  |
|
Heaven, I'm in heaven(8)

Group: Members
Joined: May 31, 2010


|
Cheers for correcting me Ashwin
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
The_Sorrow  |
|
Heaven, I'm in heaven(8)

Group: Members
Joined: May 31, 2010


|
| QUOTE (Link2012 @ Monday, Apr 16 2012, 13:14) | @Sorrow When you use 038B: load_requested_models you haven't to check if model is available, sure that it's available, in the case the checking if model is available is useless. | I get you, but i quickly scripted this
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
Deji  |
|
Coding like a Rockstar!

Group: Members
Joined: Dec 24, 2007


|
| QUOTE (The_Sorrow @ Monday, Apr 16 2012, 08:52) | P.S - Yes i know I used global variables, Don't need another 'Coding wannabe' explaining to me how I shouldn't use them. That is in no way an offense to the people who actually understand coding! | Well, not only did you use global variables, but you used $1 and $2. Now global variables are bad enough, but without using new ones properly defined in the CustomVariables.ini file, you're asking for trouble. Also, you used end_thread (004E) in a CLEO Script, which is also baaaad. And why use globals when you've plenty of locals? Actually, I guess even I used to make these crappy mistakes and even ignored several people advising me against them. I'd soon discover all my mods were buggy and generally failed in a lot of areas. I coulda listened to the people who had already made the discoveries, but perhaps jumping off a cliff into a sea of sharks is a learning step... So keep going! Also, '0609A0' is not an opcode  I'll assume you meant 09A0. And you probably don't know this, but that was probably a wise choice over 070A. They're nearly identical, except that 070A seems to set a task that affects the characters behaviour. I recall many bugs I had with my old, badly coded scripts which would've probably been solved by knowing this. So by blabbering on, I'll maybe help one or two people. Anyway, your code, made parsable and then decompiled: | CODE | 0000: NOP
:Noname_2 0247: load_model #KATANA 038B: load_requested_models 0001: wait 0 ms 00D6: if 0AB0: key_pressed 72 004D: jump_if_false @Noname_2 01B2: give_actor $PLAYER_ACTOR weapon 8 ammo 1 // Load the weapon model before using this 04C4: store_coords_to $1557 $PLAYER_CHAR $PLAYER_ACTOR from_actor $PLAYER_ACTOR with_offset 0.0 0.0 0.0 0107: $1558 = create_object #KATANA at $1557 $PLAYER_CHAR $PLAYER_ACTOR 070A: AS_actor $PLAYER_ACTOR attach_to_object 0@ offset 0.0 0.0 0.0 on_bone 6 16 perform_animation "NULL" IFP_file "NULL" time 1 09A0: actor $PLAYER_ACTOR attach_object 26@ with_offset 0.0 0.0 0.0 on_bone 5 16 perform_animation "NULL" IFP_file "NULL" time -1 0750: set_object $1558 visibility 0 066E: "ELECTRICNAR" = create_particle $1558 attached_to_object 0.1 with_offset 0.0 0.0 90.0 rotation 0.0 90.0 1 flag 1@(30@,1i) 064C: make_particle 1@(30@,1i) visible 004E: end_thread |
And look, some of the bad results of using global variables are clear: | CODE | | 04C4: store_coords_to $1557 $PLAYER_CHAR $PLAYER_ACTOR from_actor $PLAYER_ACTOR with_offset 0.0 0.0 0.0 |
$1 was compiled at $1557, which Sanny must've chosen based on my CustomVariables.ini as the next appropriate place for a global variable (which is fine, if we're basing it on the main.scm, but no, we're in CLEO). $2 is always $PLAYER_CHAR and $3 is always $PLAYER_ACTOR. So yeah, global variables... bad. This may seem like a lot of effort on my part to simply change your opinion, but unlike with certain people round here *cough* (who probably won't catch on), I consider it possible to actually teach you something. Another long post, lecture and a fun fact of the day by Deji. I apologise. I don't like messing with others' scripts (nowadays I only mess with v2 source codes, lol), but I hope the OP gets a working version of the script.
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
Deji  |
Posted: Tuesday, Apr 17 2012, 22:02
|
Coding like a Rockstar!

Group: Members
Joined: Dec 24, 2007


|
| QUOTE (JACK JONES @ Tuesday, Apr 17 2012, 05:44) | | But what if someone who makes a CLEO scrypt for VC (where we have 15 locals+timers) suddenly needs more than 15 variables (for actors, cars, markers...) but he can't use globals because it's a CLEO scrypt? Is there some alternative CLEO solution for those cases? |
VC, not sure. Can't recall if it supported proper arrays. If so, then this may interest you. There is even a way to use named global variables as pointers to memory locations here. Perhaps there's a similar method that can be applied with VC. Otherwise, there's always file or memory writing and reading and other smart uses of variables that can make variable limits a thing of the past. | QUOTE | Deji,
That code didn't work, it crashes when i press H |
I never said it would. I did explain why I wasn't posting a modified version of the code at the end of the post, but I guess my long posts get skipped. This post has been edited by Deji on Tuesday, Apr 17 2012, 22:08
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
Track this topic
Receive email notification when a reply has been made to this topic and you are not active on the board.
Subscribe to this forum
Receive email notification when a new topic is posted in this forum and you are not active on the board.
Download / Print this Topic
Download this topic in different formats or view a printer friendly version.
| |
 |
|
 |
|
|
|
|