Coding

 Reply to this postStart new topic

Opcode alternatives

ThirteenAG
post Feb 7 2011, 07:28 PM
Post #1


Ameteur Member

Posts: 54
Joined: 8-January 11



I have a question about cleo 4 opcodes:
SANNY
0AE1: $actor = random_actor_near_point 0@ 1@ 2@ in_radius 10.0 find_next 1 pass_deads 1 //IF and SET
0AE2: $car = random_vehicle_near_point 0@ 1@ 2@ in_radius 10.0 find_next 1 pass_wrecked
0AE3: $object = random_object_near_point 0@ 1@ 2@ in_radius 10.0 find_next 1 //IF and SET


Is there any way to use it with cleo 3? I mean use special scm function instead or maybe load cleo4.asi like dll(0AA2) and use
SANNY
0AA5: call [address] num_params 7 pop 7 $actor 0@ 1@ 2@ 10.0 1 1
or something else?

This post has been edited by ThirteenAG: Feb 7 2011, 07:29 PM
Go to the top of the page
 
+Quote Post
DK22
post Feb 7 2011, 09:23 PM
Post #2


Member

Posts: 197
From: Liberty City, Shoreside
Joined: 15-July 10



Use interceptor.
sannybuilder.com/forums/viewtopic.php?id=75&p=1
Go to the top of the page
 
+Quote Post
ThirteenAG
post Feb 7 2011, 10:01 PM
Post #3


Ameteur Member

Posts: 54
Joined: 8-January 11



I want find a universal way to use any cleo 4 opcode in cleo 3, but interceptor not bad too in this case.
What about rest of "single"(i mean like 0AEF, and not like 0AC8-0AC9) opcodes? For example
SANNY

0ADB: 0@v = car_model #LANDSTAL name
0ADD: spawn_car_with_model #RHINO at_player_location
0AEA: $actor = actor_struct $ped_struct handle
0AEB: $car = car_struct $vehicle_struct handle
0AEС: $object = object_struct $object_struct handle

etc...

This post has been edited by ThirteenAG: Feb 7 2011, 10:02 PM
Go to the top of the page
 
+Quote Post
Deji
post Feb 7 2011, 10:32 PM
Post #4


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



You can't do "any" CLEO 4 opcode in CLEO 3. That's why CLEO 4 was created, just use it, since it's exactly what you're asking for.

There are ways to replicate the operations of any CLEO 4 opcodes in the SCM, but it's a bit too much of complex thing to be doing when CLEO 4 is available. For small mods where you only need one or two CLEO 4 operations, making them CLEO 3 compatible is reasonable. But for things where you really want most of the CLEO 4 functionality, use CLEO 4.

Download the IDB from Sanny Builder (can't quite remember where it is) and you can start to learn to find this stuff for yourself. There are many things that go into each opcode in CLEO 4, so it's not possible to post it all here. It's not like you can expect to find any function and pass the parameters if it were an opcode.


--------------------
Go to the top of the page
 
+Quote Post
ThirteenAG
post Feb 7 2011, 10:58 PM
Post #5


Ameteur Member

Posts: 54
Joined: 8-January 11



QUOTE (Deji @ Feb 7 2011, 11:32 PM) *
You can't do "any" CLEO 4 opcode in CLEO 3. That's why CLEO 4 was created, just use it, since it's exactly what you're asking for.

There are ways to replicate the operations of any CLEO 4 opcodes in the SCM, but it's a bit too much of complex thing to be doing when CLEO 4 is available. For small mods where you only need one or two CLEO 4 operations, making them CLEO 3 compatible is reasonable. But for things where you really want most of the CLEO 4 functionality, use CLEO 4.

Download the IDB from Sanny Builder (can't quite remember where it is) and you can start to learn to find this stuff for yourself. There are many things that go into each opcode in CLEO 4, so it's not possible to post it all here. It's not like you can expect to find any function and pass the parameters if it were an opcode.


Well, i don't need all opcodes at all. Just want to use couple opcodes when i need it.
According to readme, cleo 4 contains changed cleo 3 opcodes, consequently bugs, so i can't use it.
But pure cleo3 + new opcodes would be awesome smile.gif
Go to the top of the page
 
+Quote Post
ThirteenAG
post Feb 8 2011, 12:25 AM
Post #6


Ameteur Member

Posts: 54
Joined: 8-January 11



I'm sorry for double posting, but things were easier than i expected.
For example, take three similar opcodes from above:
SANNY
0AEA: $actor = actor_struct $ped_struct handle
0AEB: $car = car_struct $vehicle_struct handle
0AEС: $object = object_struct $object_struct handle

With cleo 3, how i just figured out, i can do next:
SANNY
_CPool_CPed__handleOf $ped_struct StoreTo $actor
_CPool_CVehicle__handleOf $vehicle_struct StoreTo $car
_ObjectPool__handleOf $object_struct StoreTo $object

i.e.
SANNY
0AA7: call_function 0x4442D0 num_params 1 pop 0 $ped_struct $actor
//== 0AEA: $actor = actor_struct $ped_struct handle

0AA7: call_function 0x424160 num_params 1 pop 0 $vehicle_struct $car
//== 0AEB: $car = car_struct $vehicle_struct handle

0AA7: call_function 0x550020 num_params 1 pop 0 $object_struct $object
//== 0AEC: $object = object_struct $object_struct handle

And that exactly what i'm tried to say in first post smile.gif

This post has been edited by ThirteenAG: Feb 8 2011, 12:37 AM
Go to the top of the page
 
+Quote Post
Deji
post Feb 8 2011, 01:05 AM
Post #7


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



Not everything works like that. For example, with 0AE1 I'd imagine CLEO 4 does a lot of legwork. It loops through pools and does all the required checks. Then it adds references to the actor. The exact function can't be recreated without knowing how CLEO 4 does those things. Same with 0ADB, there is no direct function for that.

There's not a function for everything. CLEO 4, however, makes long processes simple functions and a lot of these can be powerful when used correctly. Also, using single functions is a bad move when it comes to compatibility. Different exe's have different addresses and function locations. It's usually necessary to read calls to the functions and add the offsets, which is a longer process. Having the exact addresses is usually a safer bet.


--------------------
Go to the top of the page
 
+Quote Post
Reply to this postStart new topic

3 User(s) are reading this topic (3 Guests and 0 Anonymous Users)
0 Members: