|
 |
|
|
|
|
|
Attention:
This is for the discussion and releasing of tutorials for modifying GTA. Anything that isn't a tutorial will be deleted without notification.
- Please read the Official Modification Forum Rules & Procedure BEFORE posting!
- Data topics: The following topics contain information for formatting and writing tutorials.
- Requests are to be made in the pinned topic.
- New topics to this forum are subject to moderation, and will not appear immediately. Pending approval by a moderator, if a topic is deemed unsuitable it will be deleted without notification.
|
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)
|
Mission Coding for Dummies and Pro's! Reaction Thread
 |
|
 |
| |
KornEL[HUN]  |
|
a good txd editor

Group: Members
Joined: Jun 21, 2009


|
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
Deji  |
|
Coding like a Rockstar!

Group: Members
Joined: Dec 24, 2007


|
I'm "nitpicking" here... | CODE | repeat wait 0 ms if 00E1: player 0 pressed_key 15 then 08DA: remove_panel $MENU 03E6: remove text box jump @END end until 00E1: player 0 pressed_key 16 |
Even though I barely know what that means (I find most of the high-level constructs hard to get my mind around), I assume it's basically this... | CODE | :BLKMRKT_DEAL2 wait 0 if 80E1: not player 0 pressed_key 15 else_jump @BLKMRKT_REMOVEPANELSANDPRECHECK if 80E1: not player 0 pressed_key 16 else_jump @BLKMRKT_DEAL2 08D7: 5@ = panel 0@ active_row jump @BLKMRKT_DEALDRUGS |
To save threads, complication and time... I like to use (and teach people to use) this instead: | CODE | :BLKMRKT_DEAL2 wait 0 // If player pressed key (Enter) if 80E1: not player 0 pressed_key 15 // Then jump to the remove panel thread. else_jump @BLKMRKT_REMOVEPANELSANDPRECHECK // Store the row that is currently selected. 08D8: 5@ = panel 0@ selected_row // If selected the first row. if 8039: not 5@ == 0 // Jump to the deal drugs thread. else_jump @BLKMRKT_DEALDRUGS // If selected the second row. if 8039: not 5@ == 1 // Jump to the deal weapons thread. else_jump @BLKMRKT_DEALWEAPONS // Loop. jump @BLKMRKT_DEAL2 |
(I even commented my code, just for you!  ) The selected_row opcode only activates once a player selects a row. Thus saving the "if player pressed NUM0 or w/e you're control is" loop (teehee, I used the word "thus"!). This difference is slight, but it highlights the difference between the two opcodes. One of them can be used to test if a player has pressed the row... And one can be used to see if the player highlighted the row. This is incredibly useful to me during the Black Market mod (it was actually the cause of me discovering these differences... saved my life)... I created a table in which you could press the left and right keys while highlighting an option to change the values of that option. Which was a lifesaver! Before, I had to create double the amount of fxt entries and have the player press a row (which was then highlighted ~y~) before they could change the values. Anyway... The point is, there is a difference between the 2 opcodes that I think people are missing out on... Big time! And I want people to know it. Instead of ending up like me when I was wondering why my table wasn't working the way I wanted Note to all of you that you have just had your first exclusive preview of the Black Market mod... And to get you excited, everyone who happens to be reading this (only a few of you) I can say this to... IT'S GONNA BE f*ckING GREAT!! This post has been edited by Deji on Friday, Jul 24 2009, 01:30
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
Dutchy3010  |
|
Female SCM coder!

Group: Moderators
Joined: Jul 30, 2006



|
Deji, you have to keep in mind that this is a tutorial for beginners. If there is a difference between two opcodes and can be used both, doesn't mean that I have to explain that. The method I'm using is a good method, I've used it for every menu I made so far, including all the DYOM menu's. I'm just saying how you CAN do it, of course it doesn't mean that it's the only way. If they are more advanced, they don't need my tutorial, and they can do it themselves. Then they can go and try things, without using the tutorial. Just like you did. I keep it simple, only the basics and only one way to do it (most of the time). Just to keep it clear, so nobody will get confused. It's difficult enough without explaining every single opcode that can be used for something. About your way of commenting it, I just don't think that will make it more organized.  And about the repeat-wait-until, that is in my opinion the best way to make it, so that's what I explain it in the tutorial.
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
Pages:
(4) 1 [2] 3 4
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.
| |
 |
|
 |
|
|
|
|