IMG

 
IMG
IMG   IMG
  Welcome to GTAForums! Be sure to check out the Grand Theft Auto V Forum.

You are not registered! (If you are, click here to login) Registering is fast, free and easy and allows you to instantly reply to any topic on GTAForums.
Why wait? Click here to register your own unique username and become part of the ever-growing community!


( Log In | Register | Revalidate Validation E-mail )
Quick Log-In:
  IMG
       
>
Forum Rules GTA Modification Forums

Please post mod releases in the Mod Showroom

GTAGarage.com
free mod hosting from GTANet, simply login with your GTAForums account details

GTAModding.com
GTANet's modding wiki

GTA Modding Chatroom
provided by irc.gtanet.com (Don't have an IRC client? Click here)


  Reply to this topicStart new topicStart Poll

 Opcode help

 (If) Full Car
 
sgtpepper901  
Posted: Monday, Apr 16 2012, 22:35
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Apr 13, 2012

XXXXX



Hi, I need help finding, or making, an opcode. It's to be placed under If and here is how it goes. I want it to be (If) the player's car has no empty seats.

I tried this

CODE

00D6: if
0000: actor $PLAYER_ACTOR car_max_passengers


I'm not sure if that would work or is even close to being right. Please help me.

PM
  Top
 

 
Rapier  
Posted: Monday, Apr 16 2012, 22:57
Quote Post


Retired scripter
Group Icon
Group: Members
Joined: Aug 14, 2005

ba.gif

XXXXX



First of all, that game is? GTA3, VC, SA?
PM
  Top
 

 
sgtpepper901  
Posted: Monday, Apr 16 2012, 23:15
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Apr 13, 2012

XXXXX



Sorry. It is for GTA SA.
PM
  Top
 

 
Link2012  
Posted: Tuesday, Apr 17 2012, 02:54
Quote Post


Wut?
Group Icon
Group: Members
Joined: Jan 30, 2011

ba.gif

XXXXX



CODE
//  Example of use:
//  if
// 0AB1: call_scm_func @ActorCar_SeatsFull 1 Actor $PLAYER_ACTOR
:ActorCar_SeatsFull{Actor}
03C0: 0@ = actor 0@ car
if 0@ <> -1
then
   01E9: 1@ = car 0@ num_passengers
   01EA: 2@ = car 0@ max_passengers
   1@ > 2@
else
   0485: return_true
end
0AB2: ret 0


Not sure if this part "1@ > 2@" is right, I didn't test.

This post has been edited by Link2012 on Tuesday, Apr 17 2012, 05:24
PMMSN
  Top
 

 
sgtpepper901  
Posted: Tuesday, Apr 17 2012, 03:40
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Apr 13, 2012

XXXXX



If this works then by God you are amazing. cookie.gif cookie.gif cookie.gif cookie.gif cookie.gif cookie.gif cookie.gif cookie.gif cookie.gif cookie.gif Many cookies for you. Will test it tomorrow.

PM
  Top
 

 
Wesser  
Posted: Tuesday, Apr 17 2012, 10:12
Quote Post


The complexity simplifier, the efficiency optimizer
Group Icon
Group: Members
Joined: Aug 19, 2006

eu.gif

Member Award




QUOTE (Link2012 @ Tuesday, Apr 17 2012, 03:54)
Not sure if this part "1@ > 2@" is right, I didn't test.

It isn't. The compiler is unable to understand that syntax because it doesn't know the type of those local variables, so it cannot decide arbitrarily which opcode is better to use. They must be declared first:
CODE
[...]

if
00DF:  actor $PLAYER_ACTOR driving
then
  03C0: 0@ = actor $PLAYER_ACTOR car
  if
  0AB1: call_scm_func @areVehicleSeatsFull 1 vehicle 0@
  then
    // Player's vehicle seats are full
  end
end

[...]

//  Example of use:
//  if
//  0AB1: call_scm_func @areVehicleSeatsFull 1 vehicle 0@
:areVehicleSeatsFull{handle}
var
  1@: Integer
  2@: Integer
end
if 0@ <> -1
then
  01E9: 1@ = car 0@ num_passengers
  01EA: 2@ = car 0@ max_passengers
  1@ == 2@
else
  059A: return_false
end
0AB2: ret 0

I fixed the code a little bit. wink.gif
PMMSNPlayStation Network
  Top
 

 
Link2012  
Posted: Tuesday, Apr 17 2012, 16:03
Quote Post


Wut?
Group Icon
Group: Members
Joined: Jan 30, 2011

ba.gif

XXXXX



QUOTE (Wesser @ Tuesday, Apr 17 2012, 07:12)
QUOTE (Link2012 @ Tuesday, Apr 17 2012, 03:54)
Not sure if this part "1@ > 2@" is right, I didn't test.

It isn't. The compiler is unable to understand that syntax because it doesn't know the type of those local variables, so it cannot decide arbitrarily which opcode is better to use.

This is'nt a error at all tounge.gif
PMMSN
  Top
 

 
SilentPL  
Posted: Tuesday, Apr 17 2012, 17:02
Quote Post


Senior File Manager
Group Icon
Group: Members
Joined: Feb 1, 2010

pl.gif

Member Award




Fixed the code a little bit yet tounge.gif

CODE
//  Example of use:
//  if
//  0AB1: call_scm_func @areVehicleSeatsFull 1 vehicle 0@
:areVehicleSeatsFull{handle}
var
 1@: Integer
 2@: Integer
end
if 0@ <> -1
then
 01E9: 1@ = car 0@ num_passengers
 01EA: 2@ = car 0@ max_passengers
 1@ == 2@
end
0AB2: ret 0

return_false was still useless.

This post has been edited by SilentPL on Tuesday, Apr 17 2012, 17:05
Users WebsitePMMSNXbox Live
  Top
 

 
sgtpepper901  
Posted: Tuesday, Apr 17 2012, 20:15
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Apr 13, 2012

XXXXX



But "then" isn't valid, it should work without that right?
PM
  Top
 

 
SilentPL  
Posted: Tuesday, Apr 17 2012, 20:19
Quote Post


Senior File Manager
Group Icon
Group: Members
Joined: Feb 1, 2010

pl.gif

Member Award




Who said it's not valid? It's perfectly valid.
Users WebsitePMMSNXbox Live
  Top
 

 
sgtpepper901  
Posted: Tuesday, Apr 17 2012, 20:34
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Apr 13, 2012

XXXXX



My bad, I put it in wrong.
PM
  Top
 

 
Wesser  
Posted: Wednesday, Apr 18 2012, 07:48
Quote Post


The complexity simplifier, the efficiency optimizer
Group Icon
Group: Members
Joined: Aug 19, 2006

eu.gif

Member Award




QUOTE (Link2012 @ Tuesday, Apr 17 2012, 17:03)
This isn't an error at all. tounge.gif

No, the last comparing condition was wrong. tounge.gif

QUOTE (SilentPL @ Tuesday, Apr 17 2012, 18:02)
return_false was still useless.

Indeed, the first condition already returns false, so returning a false value again is inefficent. smile.gif
PMMSNPlayStation Network
  Top
 

 
Rapier  
Posted: Wednesday, Apr 18 2012, 23:50
Quote Post


Retired scripter
Group Icon
Group: Members
Joined: Aug 14, 2005

ba.gif

XXXXX



QUOTE (SilentPL @ Tuesday, Apr 17 2012, 15:02)
Fixed the code a little bit yet tounge.gif

CODE
//  Example of use:
//  if
//  0AB1: call_scm_func @areVehicleSeatsFull 1 vehicle 0@
:areVehicleSeatsFull{handle}
var
 1@: Integer
 2@: Integer
end
if 0@ <> -1
then
 01E9: 1@ = car 0@ num_passengers
 01EA: 2@ = car 0@ max_passengers
 1@ == 2@
end
0AB2: ret 0

return_false was still useless.

Create functions is an efficient way to solve common problems in time to make the script. The function above is a good example. Does anyone know if exist others???
PM
  Top
 

 
Deji  
Posted: Thursday, Apr 19 2012, 00:44
Quote Post


Coding like a Rockstar!
Group Icon
Group: Members
Joined: Dec 24, 2007

ja.gif

XXXXX



Despite everything, I'm thinking (or hoping, rather) coding and programming modification is getting more advanced. Or at least I'm able to see that there are other modders who can handle the most demanding of challenges in modding. My website, GTAG (no links this time, I'm still not sure enough to say that wouldn't cause a drama), changed from a really lax effort at a GTA fansite to a place with a reasonably heavy amount of good modding content, particularly around the coding areas. So I'm trying to drive that forward and expand to more areas of modding that I also still have to learn.

Anyway, my there's a coding snippets topic which has gathered a nice amount coding tricks and many 'SCM functions' and even some good tricks which can be used when creating your own SCM Funcs. Because it's still a small community of knowledgable modders, not a lot else aside from documentation and code gets posted. Just a small, managable amount of help topics. Not trying to pat myself on the back, of course. I'm just (a bit psychotically) eager to have more people working towards breakthroughs in modding. I want the information to be open and easily accessible. You've played your role in the past in helping set the way for future and it's nice to think that my contributions will too help other people to go that further step (and in turn, I'll learn from their discoveries).

I really shouldn't be allowed to post unless it's about modding.

PS: I had a pretty stressful day, I'm probably talking a lot of junk, it's one of those appreciate the good things times tounge2.gif
Users WebsitePM
  Top
 

 
sgtpepper901  
Posted: Thursday, Apr 19 2012, 02:27
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Apr 13, 2012

XXXXX



Wow, I am honored to have the creator of one of these sites post that on my own thread!
PM
  Top
 

 

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

0 Members:

Topic Options Reply to this topicStart new topicStart Poll
Search topic for posted by (exact match)



 
IMG IMG