GTAMP.com

Grand Theft Auto Multiplayer
It is currently Sat May 25, 2019 9:18 pm

All times are UTC




Post new topic Reply to topic  [ 113 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: 520
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.014 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: 216
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

_________________
My channels:
https://t.me/logofero
https://twitter.com/logofero


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: 216
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.

_________________
My channels:
https://t.me/logofero
https://twitter.com/logofero


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

Joined: Fri Apr 24, 2009 9:43 pm
Posts: 520
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: 520
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.016 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  
 
PostPosted: Wed Feb 20, 2019 5:04 pm 
Offline
User avatar

Joined: Fri Apr 24, 2009 9:43 pm
Posts: 520
Location: Estonia
Hi.

I think i found bug in miss2 or whats the problem, maybe somebody can tell me.
In doc:

• DO WHILE LOOPS
Another loop variant. However, this loop guarantees to execute the commands in the block once as the end check is at the end of the loop,
e.g.
DO
counter = counter + 1
WHILE_TRUE ( counter < 100 )

DO
commands
WHILE_TRUE ( expression )


Tried with simple script and miss2 doesnt compile this.

COUNTER c1
counter c2
counter c3
PLAYER_PED p1 = (117.0,133.5,255.0) 10 270 // Red
LEVELSTART
do
do_nowt
c1=c1+1
while_true(c1<3)

LEVELEND

Screams at the c1 invalid token
I cant even do:

Syntax: [ Download ] [ Hide ]
Using GTA2 Script Syntax Highlighting
SET c1 = c2 + 4
Parsed in 0.013 seconds, using GeSHi 1.0.8.10


Wth??
Is this "normal" bug in miss2 or im doing something wrong??

EDIT: its miss2. Its hungry for round brackets.


Anybody has a complete list of "expressions" miss2 supports?
I have:

Syntax: [ Download ] [ Hide ]
Using GTA2 Script Syntax Highlighting
set c1=(c1 + 1)
set c1=(c1 - 1)
set c1=(c1 * 1)
set c1=(c1 / 1)
set c1=(c1 mod 1)
set c1=(c1 + c2)
set c1=(c1 - c2)
set c1=(c1 * c2)
set c1=(c1 / c2)
set c1=(c1 mod c2)
++c1
--c2
Parsed in 0.015 seconds, using GeSHi 1.0.8.10


Also have some TM test scripts with weird syntax expressions that do not make sense.
Are they even used anywhere?
I mean in such "raw" form.

Syntax: [ Download ] [ Hide ]
Using GTA2 Script Syntax Highlighting
count1+ -1
count2+-2
count3+12
-1 +count1 
-1+count2
12+count3
count5+count1
count4+count2
count3+count3
-1 -count1
-1-count2
12-count3
count5-count1
count4-count2
count3-count3
Parsed in 0.014 seconds, using GeSHi 1.0.8.10

_________________
Always wear safety glasses while programming.


Top
 Profile  
 
PostPosted: Thu Feb 21, 2019 10:58 am 
Offline
Psycho
User avatar

Joined: Sun Feb 21, 2010 10:03 pm
Posts: 58
B-$hep: while not a answer to your question.. i did reply to your PM but got no answer, just a heads up.. to check your inbox.


Top
 Profile  
 
PostPosted: Thu Feb 21, 2019 5:51 pm 
Offline
User avatar

Joined: Fri Apr 24, 2009 9:43 pm
Posts: 520
Location: Estonia
Ah, ok, didnt notice. Have been too busy and tired after work..

Anyways, i was messing with NOT command and thats why i needed all kinds of possible expressions..
NOT command gave me alot of trouble but i figured it out.
Also it was messing up compile logic etc..
Now i figured out why..

Im currently fixing and working on it.
And because code is generalized then it should also fix the issues for do_while_true, while_endwhile.
Im currently using if..else..endif

For loops do not compile in miss2 but i think i can make for loop to work also in new compiler.
Later..

_________________
Always wear safety glasses while programming.


Top
 Profile  
 
PostPosted: Sun Feb 24, 2019 2:38 pm 
Offline
User avatar

Joined: Fri Apr 24, 2009 9:43 pm
Posts: 520
Location: Estonia
Ok.
BIL.mis compiles and runs in GTA2 fine.
I just compiled the bil.mis and the resulting bil.scr was copied over the original file in data folder.
Gta2 was happy with it. The rest of the files in bil folder are original.
Messed for 15 minutes in game and no crashes.
There shouldn't be. Because its compiled correctly.

Of course all the other missionscripts and stuff are not included in compilation atm.
I can read and parse them but there is some more work to do before i get into them fully.

But its nice to see huge bil.mis (132KB) compiled within few seconds and Gta2 accepting it.
It was not possible in earlier versions.. because of many missing complicated things..

_________________
Always wear safety glasses while programming.


Top
 Profile  
 
PostPosted: Sun Feb 24, 2019 5:31 pm 
Offline
User avatar

Joined: Sat Dec 26, 2009 11:53 pm
Posts: 1106
wow, thats great progress

_________________
yur sa'nok ngeyä


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

All times are UTC


Who is online

Users browsing this forum: h0x91b and 2 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:  
Powered by phpBB® Forum Software © phpBB Group