12jango Posted April 7, 2014 Share Posted April 7, 2014 (edited) {$CLEO .cs}thread 'sweat':LOADwait 0Model.Load(615)Model.Load(#NULL)if and Model.Available(615) Model.Available(#NULL)jf @LOAD:TRIwait 0if and Player.Defined($PLAYER_CHAR) 0AB0: key_pressed 49jf @TRI04C4: store_coords_to 11@ 12@ 13@ from_actor $PLAYER_ACTOR with_offset 0.0 3.0 5.0 04C4: store_coords_to 14@ 15@ 16@ from_actor $PLAYER_ACTOR with_offset 13.0 3.0 5.0 0@ = Object.Create(615, 11@, 12@, 13@)20@ = Object.Create(615, 14@, 15@, 16@):TOwait 0Object.Angle(0@) = 0.0 Object.Angle(20@) = 0.0 if and Player.Defined($PLAYER_CHAR) 0AB0: key_pressed 50jf @TO:wANwait 00400: store_coords_to 1@ 2@ 3@ from_object 0@ with_offset 0.0 0.0 0.0 // Movement velocity27@ = 0.0233@ = 77.0// Get the in-between vector0063: 4@ -= 1@0063: 5@ -= 2@0063: 6@ -= 3@// Calculate vector length050A: 28@ = distance_between_XYZ 0.0 0.0 0.0 and_XYZ 4@ 5@ 6@// Get the unit vector0073: 4@ /= 28@0073: 5@ /= 28@0073: 6@ /= 28@// Multiply the vector by velocity006B: 4@ *= 27@006B: 5@ *= 27@006B: 6@ *= 27@// Calculate the angle between the 2 points05A1: set_object 0@ rotation_velocity_about_an_axis 4@ 5@ 6@ through_center_of_body05A6: get_object 0@ rotation_velocity_about_an_axis_X 4@ axis_Y 5@ axis_Z 6@ through_center_of_body 0453: set_object 20@ XY_rotation 4@ 5@ angle 6@ jump @WAN Just a simple script; press 1 to spawn two trees in front of you then press 2 to rotate one tree. It supposed to rotate both tree, but it's only one tree rotating (object 0@), I tried to rotate the other tree (object 20@) by using opcode 05A6 first then use 0453 to rotate it but didn't work! So, what does opcode 05A6 use for? I thought it would get an object rotation so you can use it to set another object's rotation to be same as the one you get? Edited April 8, 2014 by 12jango Link to comment Share on other sites More sharing options...
Wesser Posted April 7, 2014 Share Posted April 7, 2014 (edited) You wrote $20@. SB oddly accepts this big syntactical incongruity and treats it as a local variable with a hexadecimal identifier (32@). Edited April 7, 2014 by Wesser Link to comment Share on other sites More sharing options...
12jango Posted April 8, 2014 Author Share Posted April 8, 2014 I'm sorry I made mistakes when typing the script especially the $20@ I meant it 20@. This time is the correct one. If you have time, please try it out to see what this script do. The tree on your right is the object 20@ that won't rotating. Link to comment Share on other sites More sharing options...
12jango Posted April 12, 2014 Author Share Posted April 12, 2014 (edited) Is there any way to use 05A6:? Edited April 12, 2014 by 12jango Link to comment Share on other sites More sharing options...
Seemann Posted April 12, 2014 Share Posted April 12, 2014 You wrote $20@. SB oddly accepts this big syntactical incongruity and treats it as a local variable with a hexadecimal identifier (32@). huh, funny should I fix that or leave it alone as a one yet feature? Link to comment Share on other sites More sharing options...
Silent Posted April 12, 2014 Share Posted April 12, 2014 huh, funny should I fix that or leave it alone as a one yet feature? Maybe tweak it so it's less ambiguous and allow hex for globals too? Link to comment Share on other sites More sharing options...
Wesser Posted April 12, 2014 Share Posted April 12, 2014 It is not bad at all. I would suggest to clear the ambiguity with a percent sign (%). Link to comment Share on other sites More sharing options...
fastman92 Posted April 12, 2014 Share Posted April 12, 2014 (edited) What about $0x20 - global variable with ID 320x20@ - local variable with ID 32 Edited April 12, 2014 by fastman92 Link to comment Share on other sites More sharing options...
Wesser Posted April 12, 2014 Share Posted April 12, 2014 (edited) It will be still ambiguous as x and X are valid characters for defining custom globals names. Adding a special character right after the dollar sign ($) or before the local ID will easily advert SB to treat everything following (till another distinguishing token) as a hexadecimal number. Edited April 12, 2014 by Wesser Link to comment Share on other sites More sharing options...
fastman92 Posted April 12, 2014 Share Posted April 12, 2014 Ok, true. Link to comment Share on other sites More sharing options...
Seemann Posted April 13, 2014 Share Posted April 13, 2014 GTA scripts have too much data types characters already, so I would not add a one yet as the proposed percent sign. The common convention for the variables naming is that the names must not begin with a digit. So $0x10 is not a valid name. In fact SB threats it as a hexadimal value and compiles $0x10 as $16. Similarly, 0x10@ will be compiled as 16@. It means that the fastman's way is already implemented. $20@ definitely should be reported as an error by the compiler (and it looks so, two data types characters in one token are used). Link to comment Share on other sites More sharing options...
Wesser Posted April 13, 2014 Share Posted April 13, 2014 Yes, my bad, SB behaves like most compilers do indeed. Didn't know about the way of representing variables indices in hexadecimal. I totally agree with you then. Link to comment Share on other sites More sharing options...
12jango Posted April 18, 2014 Author Share Posted April 18, 2014 (edited) So you're saying 05A6: isn't working at all? Edited April 18, 2014 by 12jango Link to comment Share on other sites More sharing options...
12jango Posted May 11, 2014 Author Share Posted May 11, 2014 Anyone? 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