|
 |
|
|
|
|
|
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
 |
|
 |
| |
goin-god  |
|
High Roller

Group: $outh $ide Hoodz
Joined: Mar 18, 2007



|
| QUOTE (NTAuthority @ Mar 27 2009, 05:22) | Hmm, it seems like I have read almost the exact same guide somewhere before... don't remember where, may be that the same person posted it there too. Even if I did know it, the updates done to a lot of parts make it an even better guide | She originally wrote it in dutch i think.
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
goin-god  |
Posted: Saturday, Apr 4 2009, 23:29
|
High Roller

Group: $outh $ide Hoodz
Joined: Mar 18, 2007



|
| QUOTE (ThaGTAGamer @ Apr 4 2009, 08:44) | Yeah... COOL tutorial, but it is for SA. Does it same with VC or GTA III??? | Well, Dutchy used Advanced coding, which i dont know if its supported in Vice. But the basics are almsot the same thing.
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
goin-god  |
|
High Roller

Group: $outh $ide Hoodz
Joined: Mar 18, 2007



|
I lol'd
Awesome work guys This post has been edited by goin-god on Sunday, May 3 2009, 20:33
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
Aschratt  |
|
Three Headed Monkey

Group: Members
Joined: Apr 12, 2006



|
| QUOTE (Dutchy3010 @ May 3 2009, 19:47) | Mission Coding for Pro's!
From now on, this is a reaction topic for Mission Coding for Dummies and Mission Coding for Pro's. It is a project of PatrickW and myself. Good luck with all the tutorials.  |
Great work! I'd enjoyed reading the tutorials (espacially the last one). To write coding style guidelines it requires alot of knowledge and practical experience. While reading both tutorials you realy feel that both of the authors got it. Anyway I'd got something to add. However those guidelines are great (Although I personally prefer the opcode-param notation... it is just a personal oppinion of myself since the "High-Level" representations are only synonyms for the opcodes in most cases), but you will get lost in huge code-files anyway. So I am talking about using SannyBuilder's directives, especially {$INCLUDE } which is a pretty usefull tool if you are working on complex scripts (Like a storyline or something in this way). $INCLUDE does nothing else than adding a predefined file to the position the directive is located. The content of this file of course needs to be SannyBuilder compatible plain text source code. As simple as this directive seems it has much power in readability of huge source. By splitting your script into multiple files and giving the files strong names descriping the content of the file in one or two words it drasticly reduces the time spent into searching for some special code. For example I am using $INCLUDE for each thread I am creating in my script file. So what I did (remember - we are talking about big sources!) was creating a file corresponding to some kind of interface. It does nothing else than including all threads. So everything I had to do was including this file right below the main-routine in my main source file. The only thing you have to be aware is that you have opened the main tab in SB before compiling the script. Otherwise you could cause errors because of missing variable declarations or something in this way. As I said the directive is rudimentary and SB only knows sequential code, so it is not able to search for references of this file. Another weak point of course is that there is no way to prevent a multiple includes of one and the same file, but this would lead to errors during compile progress because of label redeclarations usualy. At least if you have created a label there... if not you should because of the reason descriped above... The behaviour can be compared to "#pragma once" from C/C++ then. Another thing which could be improved is the part handling constant declares. For people switched over to SCM from C, Pascal or Java constants may be interprated as kinds of objects. For example have a look at this pseudo C-Code: | CODE | const int myVar = 0;
if(myVar == 0) { printf("%d", myVar); } |
(Yes I know it does not make many sense at all - it is just an example - but in an similar way this could be used to create some kind of compile-time polymorphism which means that I can define code sequences which are only executed if an constant has an certain value. If it hasn't - the code can be seen as "waste"  ) Now let's try to translate this code to SCM using const..end notation: | CODE | const myVar = 0 end
:MY_PSEUDO_CODE 00D6: if 0038: myVar == 0 // ERROR! 004D: jump_if_false @SOMEWHERE_ELSE 045A: draw_text_1number 2.0 2.0 GXT 'NUMBER' number myVar 0002: jump @SOMEWHERE_ELSE |
So the line marked as error does compile, but crash as soon as the game reaches this code segment, while the text-draw line (045A) does not crash. The reason is simple. Constants are no objects! They are just aliases. During compilation they are searched and replaced by their values. This can be strings, numbers or other constants (as the documentation of SB sais), where the other constants would cause some kind of recursion. Anyway now the compiler would get which is valid since we have specified that the first value must be an global variable. But global variables are nothing else than numbers (something like addresses... for more info see an SCM documentation). So now the game reaches there and crashes, because 0 is no valid variable. I don't know what happens if you initialize "myVar" with something else than 0, but I guess it would crash or at least end in undefined behaviour - so do not do this! That's all. As told above those are just points where I think they are worth to be mentioned. Especially the $INCLUDE directive is a great tool for readable code. So far... greetings and thank's for the nice tutorial! Keep it up, - Aschratt. This post has been edited by Aschratt on Friday, May 22 2009, 14:08
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
KornEL[HUN]  |
|
a good txd editor

Group: Members
Joined: Jun 21, 2009


|
the custom save pickup doesnt work or i have f*cked up anything i want to make a new save pickup at theese coordinates: X 2335.42 Y -1141.08 Z 1053.80 can u help me? (the new game starts but the save is not on its place) there is the code what i ve used: thread "SAVE" $SAVE_X = 2335.42 $SAVE_Y = -1141.08 $SAVE_Z = 1053.8 :SAVE_38 0395: clear_area 1 at $SAVE_X $SAVE_Y $SAVE_Z radius 1.0 $SAVE_PICKUP = Pickup.Create(#PICKUPSAVE, 3, $SAVE_X, $SAVE_Y, $SAVE_Z) :SAVE_74 wait 100 Pickup.Picked_up($SAVE_PICKUP) else_jump @SAVE_74 $ONMISSION = 1 Player.CanMove($PLAYER_CHAR) = False 03D8: show_save_screen :SAVE_106 wait 100 03D9: save_done else_jump @SAVE_106 Pickup.Destroy($SAVE_PICKUP) :SAVE_124 wait 100 Player.Defined($PLAYER_CHAR) else_jump @SAVE_124 Camera.Restore_WithJumpCut Camera.SetBehindPlayer Player.CanMove($PLAYER_CHAR) = True $ONMISSION = 0 :SAVE_158 wait 0 80EC: not actor $PLAYER_ACTOR 0 near_point 2310.32 -1141.08 radius 1053.8 2.0 else_jump @SAVE_158 jump @SAVE_38 end_thread sorry for my bad english  !
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
Pages:
(4) [1] 2 3 ... Last »
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.
| |
 |
|
 |
|
|
|
|