GTAMP.com

Grand Theft Auto Multiplayer
It is currently Wed Dec 12, 2018 5:25 pm

All times are UTC




Post new topic Reply to topic  [ 108 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6
Author Message
PostPosted: Wed Feb 21, 2018 9:52 pm 
Offline
Boss
User avatar

Joined: Tue Mar 04, 2008 6:51 am
Posts: 1345
Location: GTAMP.com
Could you make a 1 line compiler? I want to be able to enter something like p1car = CREATE_CAR (118.0,133.5,1.0) 35 270 TAXI END and get the hex version, it doesn't need the header or footer since I'm going to be writing it into GTA2 RAM, not loading an SCR.

Splitting an existing SCR into each hex line would be useful too, mucher easier for me to copy and paste, I have a hard time figuring out where each command starts and ends when just looking in a hex editor.

I noticed this small script doesn't give a weapon when I use your compiler:

PLAYER_PED p1 = (117.0,133.5,255.0) 10 270 // Red
LEVELSTART
GIVE_WEAPON (p1, electro_gun)
LEVELEND


Top
 Profile  
 
PostPosted: Wed Mar 14, 2018 9:26 pm 
Offline
User avatar

Joined: Fri Apr 24, 2009 9:43 pm
Posts: 515
Location: Estonia
Hello Sektor.

Sorry for late reply.
I have been busy with my personal life and i was i ski vacation in Slovakia tatras for 1 week with gf. My first time serious mountain skiing.

I will try to make that 1 line compiler.
Probably i must just add some command line switch, so when you the switch then it allows compiling 1 line.

But the variables must be declared, in your example:
Syntax: [ Download ] [ Hide ]
Using GTA2 Script Syntax Highlighting
p1car = CREATE_CAR (118.0,133.5,1.0) 35 270 TAXI END
Parsed in 0.012 seconds, using GeSHi 1.0.8.10


"p1car" should be declared.


But im thinking...
Maybe make another separate tool for the current moment. So when you type in this example above then it will show you the HEX representation of it, how it would look like in .scr file.
Would this work?

But is your p1car declared already in game? When you write this line into game memory?


Dunno if you use some .cmd or .bat file to execute the compiler or you just drop the mis file onto the exe?
Should this be another compiler or just add command line switch?


Also i will check the reported bug. Dunno what it could be. So simple script. But i have some ideas already what could cause this.
I havent worked on this thing for a while.

Its just that coding motivation goes away for some time and then i dont have any interest in this stuff. I have to do other things.
Some time passes and i get my interest back in computer coding.

But i will check these 2 things and what i can do.

Thanks Sektor.

_________________
Always wear safety glasses while programming.


Top
 Profile  
 
PostPosted: Thu Mar 15, 2018 8:27 pm 
Offline
Serial Killer

Joined: Wed Dec 09, 2015 2:18 pm
Posts: 208
Sektor wrote:
I noticed this small script doesn't give a weapon when I use your compiler:

PLAYER_PED p1 = (117.0,133.5,255.0) 10 270 // Red
LEVELSTART
GIVE_WEAPON (p1, electro_gun)
LEVELEND

Probably does not issue, because the character spawns outside the frame on this weapon is not written to the structure.

Note: I came across a similar phenomenon for this it is better to check whether a minimum of 1 frame has passed to accurately change the player's data:
Code:
PLAYER_PED player = (117.0, 133.5) 10 270
LEVELSTART
EXEC
GIVE_WEAPON (player, electro_gun)
ENDEXEC
LEVELEND

_________________
Map F-Industry-Live
MISI Library


Top
 Profile  
 
PostPosted: Fri Mar 16, 2018 10:22 pm 
Offline
Boss
User avatar

Joined: Tue Mar 04, 2008 6:51 am
Posts: 1345
Location: GTAMP.com
It works fine on official compiler, so it's just a bug/unsupported feature in B-$hep's compiler.


Top
 Profile  
 
PostPosted: Fri Mar 16, 2018 10:35 pm 
Offline
Boss
User avatar

Joined: Tue Mar 04, 2008 6:51 am
Posts: 1345
Location: GTAMP.com
B-$hep wrote:
I have been busy with my personal life and i was i ski vacation in Slovakia tatras for 1 week with gf. My first time serious mountain skiing.

This is way more fun and important than GTA2.

B-$hep wrote:
But is your p1car declared already in game? When you write this line into game memory?

Yes the car would need to be declared first, just adding CREATE_CAR to a live script without declaring first would crash.

Seems Logofero already figured out how to create objects/cars by modifying RAM, so I don't really need a one line compiler anymore but it could have other uses.

B-$hep wrote:
Dunno if you use some .cmd or .bat file to execute the compiler or you just drop the mis file onto the exe?
Should this be another compiler or just add command line switch?

I'm not a drag and drop person, I prefer command line/batch files.


Top
 Profile  
 
PostPosted: Sat Mar 17, 2018 8:39 am 
Offline
Serial Killer

Joined: Wed Dec 09, 2015 2:18 pm
Posts: 208
Sektor wrote:
Seems Logofero already figured out how to create objects/cars by modifying RAM, so I don't really need a one line compiler anymore but it could have other uses.

My method replaces the entire SCR and load at the start of the game.

Firstly: this is the need to avoid a crash (because there is a risk to change the SCR already created and you need to have a command to reboot the existing SCR in memory, but is none). Secondly, it clears the level of existing missions so that the scripter himself creates new ones in the LUA language.

Now I'm completing the search for all the offsets created by SCR. Then it will be necessary to prepare the documentation. All this requires painstaking work.

_________________
Map F-Industry-Live
MISI Library


Top
 Profile  
 
PostPosted: Sat Jul 07, 2018 2:47 pm 
Offline
User avatar

Joined: Fri Apr 24, 2009 9:43 pm
Posts: 515
Location: Estonia
Hello all.

I found a bit of motivation to work on this stuff again.
There were some problems with NOT command stuff. I knew what was the problem when i left the project in december 2017.
Lots of time has passed since.
I kinda know what was the problem, i just have to refresh the memory and watch/read the code..

Project is huge and so is the sourcecode and it grows and grows. Its complex but this was the only biggest problem i had i think.
I know i tried to compile the whole BIL.MIS example that comes with miss2.

And then i noticed problems near the NOT command and then i started working on it and i stopped in december 2017 for some reason. Dunno..


Sektor wrote:
I noticed this small script doesn't give a weapon when I use your compiler:

PLAYER_PED p1 = (117.0,133.5,255.0) 10 270 // Red
LEVELSTART
GIVE_WEAPON (p1, electro_gun)
LEVELEND



Interesting bug. I tested in my compiler and in GTA2. Weapon flashes for a sec and disappears. Dunno atm what causes it because it was fine before and working ok. There are indeed differences in miss2 scr file and new comp. scr file
Have to debug it.

Will post here if i get any new info on this stuff.

EDIT: seems that i fixed it. There was some code commented out for some reason and variable initialization mistype.
C++
Code:
int ammo= -1;  // Was: int ammo= 0;

Expression expected the ammo to be initialized to -1 but it was actually 0.
So the expression was never executed.
C++
Code:
                if(ammo!=-1){
                    header.type=SCRCMD_GIVE_WEAPON2;
                    ...
                }

                else{ // THIS EXPECTED ammo to be -1 initally
                    header.type=SCRCMD_GIVE_WEAPON1;
                    ...
                }


That was all to make it work again.
Will update the attached compiler later.

Interesting that i havent forgot C++.
Haven't coded for "ages" (since dec.2017). Same with Delphi.

_________________
Always wear safety glasses while programming.


Top
 Profile  
 
PostPosted: Sat Jul 07, 2018 5:08 pm 
Offline
User avatar

Joined: Fri Apr 24, 2009 9:43 pm
Posts: 515
Location: Estonia
Found some lines of C++ code that caused to crash the compiler when it had script with "NOT" command in them in particular cases.
Commented these lines out. Have to look later why they were added. Maybe they are useless anyway.

So far i have found stuff that works fine and some things that do not work with "NOT" command.

Syntax: [ Download ] [ Hide ]
Using GTA2 Script Syntax Highlighting
//OK
if(not(c1=2))
        do_nowt
    ENDIF

//-----------------------------------------------------------------------
//OK
if(not(is_brief_onscreen ()))
   

        do_nowt
    ENDIF
   
//-----------------------------------------------------------------------
// ALMOST OK. CMD_NEXT wrong or something.
if((is_brief_onscreen ()) and

(not(is_brief_onscreen ())))
        do_nowt
    ENDIF
   
   
// PRETTY MESSED UP:
if((is_brief_onscreen ()) and
    (not(c1=2)))

        do_nowt
ENDIF
Parsed in 0.014 seconds, using GeSHi 1.0.8.10


Maybe there is more, dunno. Im doing different tests and working on them.
This is where i left in dec. 2k17

_________________
Always wear safety glasses while programming.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 108 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group