GTA2 ScriptPad

Anything to do with GTA1/GTA2 modding (tools, scripts and more).
Post Reply
User avatar
Gustavob
Immortal
Posts: 407
Joined: 18 May 2009, 21:40
GH nick: Gustavob
|Gustavob|
Location: Nowhere.
Contact:

Re: GTA2 ScriptPad

Post by Gustavob »

Thats some great progress, B-$hep. Nice job.

About this last one feature, I guess the main problem would be multiple brackets causing errors on long IF statements, unless you're already able to figure out open brackets with no counterpart closing brackets and vice-versa like in N++. That would be something I'd love to see, and would be very helpful

Once again, nice job!

edit: just noticed I started two consecutive pages in the same topic lol
You just lost the game.
User avatar
B-$hep
Immortal
Posts: 571
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: GTA2 ScriptPad

Post by B-$hep »

Thanks Gustavob.

Yes, i tried one test script (bonusrace.mis) and deleted some brackets and endifs.
When i removed one endif, it displayed some internal parser error, nothing related to actual missing endif.
And when i removed some brackets, it just told me that the token before the bracket is unrecognised. Nothing helpful, just line number and token name:

Removed bracket on first line:

Code: Select all

IF ( IS_CHARACTER_IN_ANY_CAR  p1))
STORE_CAR_CHARACTER_IS_IN ( p1, p1car )
endif
Put the bracket back:

Code: Select all

IF ( IS_CHARACTER_IN_ANY_CAR  (p1))
STORE_CAR_CHARACTER_IS_IN ( p1, p1car )
endif
Well bracket highlighting works. I guess i just have to count IF and ENDIF's to find missing ones and maybe same for brackets.

Dunno yet. But i will try. It would be easier if miss2 displayed more useful error msg.
It's easier to parse error messages than script.
Always wear safety glasses while programming.
User avatar
B-$hep
Immortal
Posts: 571
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: mispad

Post by B-$hep »

BenMillard wrote:Could you prevent hangs due to valid but unsupported folder and file names? I just hit a problem where I had to rename a folder to make .mis files compile.
...
You asked for it, you got it:

Image

Should work with any "crazy" and unusual paths and filenames now.
File path in this example is same as yours Ben, just script content is simple test script.
Im loading file from MRU list, to speed up file opening.
But it shows that script with such long name and spaces in filename has compiled successfully.
Last edited by B-$hep on 11 Mar 2013, 01:10, edited 1 time in total.
Always wear safety glasses while programming.
User avatar
Pyro
Immortal
Posts: 414
Joined: 17 Mar 2010, 04:07
GH nick: Pyro
Location: Wales, UK

Re: GTA2 ScriptPad

Post by Pyro »

Looking good :)

Any word on script compiler crashing with certain file names? As I mentioned earlier I want to finish my single player with missions script ;)

Edit - if you haven't already, here's some extremely basic script to get any map working which could be useful for your default template:

Code: Select all

// GTA2 TEST SCRIPT

// Players
PLAYER_PED p1 = ( 127.5 , 127.5 , 255.0 ) 25 180

// Cars
PARKED_CAR_DATA player_car = ( 128.5 , 127.5 , 255.0 ) 02 180 VTYPE

// Counters
COUNTER loop = 1

// Start level
LEVELSTART

// Main loop
WHILE_EXEC ( loop = 1 )
     DO_NOWT
ENDWHILE

LEVELEND
User avatar
B-$hep
Immortal
Posts: 571
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: GTA2 ScriptPad

Post by B-$hep »

Pyro wrote:Looking good :)

Any word on script compiler crashing with certain file names? As I mentioned earlier I want to finish my single player with missions script ;)
Thanks.

Yes, crashing and such things because of certain file names should be fixed now and gone forever. Even .tmp and .### files are always removed: before and after compiling.
Edit - if you haven't already, here's some extremely basic script to get any map working which could be useful for your default template:
Thanks again, i actually had, put very poor example.
Yours is much better and nicer. I will include it and credit you.
Always wear safety glasses while programming.
User avatar
Pyro
Immortal
Posts: 414
Joined: 17 Mar 2010, 04:07
GH nick: Pyro
Location: Wales, UK

Re: GTA2 ScriptPad

Post by Pyro »

B-$hep wrote:Yes, crashing and such things because of certain file names should be fixed now and gone forever. Even .tmp and .### files are always removed: before and after compiling.
I hope so :D Can't wait to test it and see if it holds up heh heh.
User avatar
B-$hep
Immortal
Posts: 571
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: GTA2 ScriptPad

Post by B-$hep »

OK, what's new?

[*]I added the Preferences dialog where you can change bunch of editor settings, including syntax HL, font style, font colors, editor background color, enable/disable autocompletion etc.

[*]Added possibility to choose what editor will do at startup:
  • Opens last used script
  • Creates new empty script
  • Or just shows splash screen
[*]Implemented saving of many other editor settings.


Because there is pretty alot of settings to save, i decided to work a bit on it.
Always wear safety glasses while programming.
BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

Re: GTA2 ScriptPad

Post by BenMillard »

That template will be useful if you press File > New to start a script. It should include one weapon, so the object and the command can be copied and pasted. With a couple of environmental things and that's everything most arenas need. 8-)

This mission script for new levels is now tested and updated on my website.

Code: Select all

// GTA2 Test Script
// by Pyro & BenMillard, April 2011
// http://projectcerbera.com/gta/2/tutorials/multiplayer

// Weapons
// Note: This respawns instantly and gives maximum ammo.
GENERATOR rocket1 = (128.0,128.0) 0 COLLECT_02 0 0 99

// Player Cars:
PARKED_CAR_DATA p1car = (126.5,126.5,255.0) 28 225 VTYPE // Red
PARKED_CAR_DATA p2car = (126.5,129.5,255.0) 24 315 VTYPE // Orange
PARKED_CAR_DATA p3car = (129.5,129.5,255.0) 35 045 VTYPE // Yellow
PARKED_CAR_DATA p4car = (129.5,126.5,255.0) 20 135 VTYPE // Green
PARKED_CAR_DATA p5car = (128.0,130.2,255.0) 14 000 VTYPE // Dark Blue
PARKED_CAR_DATA p6car = (125.8,128.0,255.0) 02 270 VTYPE // Black

// Players
/*
 p1    p4
p6  RL = (128.5,128.5)
 p2 p5 p3
*/
PLAYER_PED p1 = (127.0,127.0,255.0) 07 045 // Yellow Scientist
PLAYER_PED p2 = (127.0,129.0,255.0) 11 135 // Green Loonie
PLAYER_PED p3 = (129.0,129.0,255.0) 10 225 // Red Russian
PLAYER_PED p4 = (129.0,127.0,255.0) 09 315 // Orange Krishna
PLAYER_PED p5 = (128.0,129.5,255.0) 13 180 // Dark Blue Yakuza
PLAYER_PED p6 = (126.5,128.5,255.0) 08 090 // Dark Grey Zaibatsu

// Counters
COUNTER stage = 1



// End of objects...
LEVELSTART
// ...start of commands.



// Environment
SET_AMBIENT_LEVEL (0.75, 0) // reduce the value after you add lights
DECLARE_POLICELEVEL (4) // 4 = SWAT; 5 = FBI; 6 = Army
// Note: Army in multiplayer needs Vike's GTA2 v11.3 or newer.

// Weapons
SWITCH_GENERATOR (rocket1, ON)

// Main Loop
// Note: Only needed for missions, game modes and gimmicks.
WHILE_EXEC (stage = 1)
  DO_NOWT
ENDWHILE


LEVELEND
Filename should be first thing in the titlebar, like Windows Explorer and MS Office. Then I can tell 3 scripts apart in the taskbar at-a-glance. So your image would have said this at the top: tiny3-arena.mis - GTA2 ScriptPad

Oh, I meant the left edge of the tooltip should align with the left edge of the parameter. If that's possible... it's the way Visual Studio 6 presents it. (For me, that's just about the nicest code editor to work in - well-balanced between simplicity and capability.)

Yeah, it's looking really cool. And exceptionally fast progress!

(EDIT) Don't try to compete with Notepad++ and other big text-based editors on total number of features. Convenience features which are highly specific to the .mis format is what makes Mis Pad favourable. Such as integrating the compiler input and output into the editor.

Aliases for the more idiosyncratic constants, tooltips and autocompletion could make ScriptPad favourable to MisPad. More refined Ctrl+Arrow behaviour for moving around and selecting code, more reliable Undo/Redo and so on would tip the balance further still. The filename fix is also very welcome!

(EDIT2) Updated template to include 6 players, with a comment shown how they are arranged. Not tested... earliest I could test this would be Wednesday evening.
Last edited by BenMillard on 17 Apr 2011, 20:03, edited 6 times in total.
User avatar
B-$hep
Immortal
Posts: 571
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: GTA2 ScriptPad

Post by B-$hep »

Thanks again Ben.
And exceptionally fast progress!
Yes, i would like to finish it soon, because i would like to continue or rewrite some of my old projects or even start some new one. I think actually continue some old one, taking a break and coming back to something after few months usually helps. At least it helped me many times.
That template will be useful if you press File > New to start a script
Done! I added this as option, create new empty script or create it from template you posted.
Filename should be first thing in the titlebar
Done!
More refined Ctrl+Arrow behaviour for moving around and selecting code
I think you meant Shift + Arrow.

Done!
more reliable Undo/Redo
I think it's done.
Oh, I meant the left edge of the tooltip should align with the left edge of the parameter.
Sorry Ben, i still don't understand. Isn't that the same in image i posted?
Can you make some fast ascii image or draw it in Paint?

EDIT:

Just had to run my VB6:
Image

Like this?

Both 'M's are almost on top of each other and left side of tooltip is aligned with 'M'.


Btw. VB6 also shows MsgBox (function name at the start of tooltip). Should i do the same?
Or it will be too long tooltip then?

I guess it will be, because some GTA2 commands are pretty long.

EDIT2: But actually this VB6 tooltip isn't short either.
Always wear safety glasses while programming.
BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

Re: GTA2 ScriptPad

Post by BenMillard »

I've updated the template but not tested, yet.
B-$hep wrote:[...] taking a break and coming back to something after few months usually helps.
Me too.
B-$hep wrote:I added this as option, create new empty script or create it from template you posted.
Always use the template, to keep the menus simple. Ctrl+A, Del turns the template into a blank script. But every level contains most (or all) of the things in that template, so I doubt any of it would usually be deleted. (Which makes the "blank script" option pretty useless, AFAICT.)
B-$hep wrote:
BenMillard wrote:More refined Ctrl+Arrow behaviour for moving around and selecting code
I think you meant Shift+Arrow.
Either and both are used for moving around code. For example, Ctrl+Right moves rightwards to the next word boundary. Ctrl+Shift+Right will select rightwards to the next word boundary.

Making this smarter about decimal numbers and individual parts of (x.x,y.y,z.z) patterns would be handy. (Full stop shouldn't be a word boundary within decimal numbers; it's the decimal point in that context.)

Double-click which was smarter about boundaries would also be neat. For bonus points, triple-click selection which is smart about line continuation. (As seen in Office, Wordpad, Notepad, Firefox and other places.)
B-$hep wrote:Both 'M's are almost on top of each other and left side of tooltip is aligned with 'M'.
Yes, that's what I had in mind. Aligning the first letters better would be nice but not essential.
B-$hep wrote:VB6 also shows MsgBox (function name at the start of tooltip). [...]

EDIT2: But actually this VB6 tooltip isn't short either.
Having the current parameter in a tooltip aligned to its position is good. The completion list could then go below the word, so it almost works like a ComboBox. (Only used if there's more than one relevant completion item.)
User avatar
B-$hep
Immortal
Posts: 571
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: GTA2 ScriptPad

Post by B-$hep »

BenMillard wrote:I've updated the template but not tested, yet
Me neither.
Always use the template, to keep the menus simple. Ctrl+A, Del turns the template into a blank script. But every level contains most (or all) of the things in that template, so I doubt any of it would usually be deleted. (Which makes the "blank script" option pretty useless, AFAICT.)
File menu is simple, ok, i will set template option as default.
To make it empty at startup user has to choose second option in preferences dialog.
BenMillard wrote:More refined Ctrl+Arrow behaviour for moving around and selecting code
I think you meant Shift+Arrow.[/quote]Either and both are used for moving around code. For example, Ctrl+Right moves rightwards to the next word boundary. Ctrl+Shift+Right will select rightwards to the next word boundary.[/quote]

I think it works already, i tried.
Consider it done, sir :) (like they said in Commandos game).
Making this smarter about decimal numbers and individual parts of (x.x,y.y,z.z) patterns would be handy. (Full stop shouldn't be a word boundary within decimal numbers; it's the decimal point in that context.)

....

Double-click which was smarter about boundaries would also be neat. For bonus points, triple-click selection which is smart about line continuation. (As seen in Office, Wordpad, Notepad, Firefox and other places.)

These 2 things i really don't understand, to be honest.
Can you explain a bit better please?
Yes, that's what I had in mind. Aligning the first letters better would be nice but not essential.
I don't know Ben, i took a quick look at this stuff, but it seems alot of work for such simple thing. It may sound strange but it seems like so.
Maybe im wrong, i repeat only quick look. I will try to finish the other important stuff first and then i will try.
Having the current parameter in a tooltip aligned to its position is good. The completion list could then go below the word, so it almost works like a ComboBox. (Only used if there's more than one relevant completion item.)
Ok, same as above.
Always wear safety glasses while programming.
User avatar
B-$hep
Immortal
Posts: 571
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: GTA2 ScriptPad

Post by B-$hep »

Can somebody drop me some multiscript?

Sektor you said (on first page of this topic) that MISS2 can compile them but mispad can't?
I would like to fix it.


And what it means: it doesn't compile? Crashes?
Always wear safety glasses while programming.
User avatar
Sektor
Boss
Boss
Posts: 1426
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: GTA2 ScriptPad

Post by Sektor »

bil.mis in http://gtamp.com/GTA2/gta2script.zip is a multiscript.
User avatar
Gustavob
Immortal
Posts: 407
Joined: 18 May 2009, 21:40
GH nick: Gustavob
|Gustavob|
Location: Nowhere.
Contact:

Re: GTA2 ScriptPad

Post by Gustavob »

B-$hep wrote: And what it means: it doesn't compile? Crashes?
displays an error on mispad, but works on normal compiler
You just lost the game.
User avatar
B-$hep
Immortal
Posts: 571
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: GTA2 ScriptPad

Post by B-$hep »

Tried with mispad:

I opened bil.mis, -> "Compile"
and then in output:
Line 79: zone declare set
Compilation stopped


No errors or anything, just stopped.

My path: C:\Program Files\gta2script\example


Found f1.mis. Also has folder f1.
It's on my desktop.

miss2 now says that it can't find the f1\pkt.mis file in it's own folder ("compiler" in this case)
I guess i have to pass some more stuff to compiler to make it find the files.
Always wear safety glasses while programming.
User avatar
Gustavob
Immortal
Posts: 407
Joined: 18 May 2009, 21:40
GH nick: Gustavob
|Gustavob|
Location: Nowhere.
Contact:

Re: GTA2 ScriptPad

Post by Gustavob »

from what Ive seen, the official compiler compiles somewhat like this:

Code: Select all

..."normal" code...
...find LAUNCH_MISSION or DO_EASY_PHONE_TEMPLATE or DO_PHONE_TEMPLATE...
...find pointed file inside folder with the same name as the main script..
...compile secondary file...
...continue main file compilation...
in case thats useful
You just lost the game.
User avatar
B-$hep
Immortal
Posts: 571
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: GTA2 ScriptPad

Post by B-$hep »

Fixed! 8-)
Just had to add one line to source, thats all.
Even the da*n bil.mis compiled now.
Always wear safety glasses while programming.
User avatar
B-$hep
Immortal
Posts: 571
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: GTA2 ScriptPad

Post by B-$hep »

Just to show you how it looks atm in general.
It's not final of course. Many things i think will be changed.
Look in HD. Im using free CamStudio to record this.

http://www.youtube.com/watch?v=_BwBTOGR1hE




Suggestions, etc also very welcome.


EDIT: i also added possibility to export to HTML.
Script looks pretty nice in HTML.

57th.mis
http://e36v4.co.cc/script.html
Always wear safety glasses while programming.
User avatar
T.M.
Immortal
Posts: 960
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: GTA2 ScriptPad

Post by T.M. »

heh, that HTML thing looks pretty cool.

Although, there are way too many different colors, i suggest you use just one color for all enums, like COLLECT_01 and etc... why dont you use my mis.stx definitions ? i already wasted lots of time to choose good colors there. after all, our coloring is almost the same... also it could be a nice idea to be able to see the same colors in my editor / your editor ;)
User avatar
B-$hep
Immortal
Posts: 571
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: GTA2 ScriptPad

Post by B-$hep »

Thank you T.M for your kind offer.
I looked at mis.stx and it looks so simple. So it's very easy for me to get the stuff into my code.

I will add you to About box.

Thanks again.

EDIT: OK, done.
Looks familiar?

Image

Of course user an change these colors, including background color, font etc.
Maybe Lucida Console is nicer than Courier New (that i currently use)?
But it's not on Win95 / Win98, it's on XP but on Win7?

Yeh, don't be surprised, i still use Win95 also. Love playing GTA2 on it. Nostalgia.
Always wear safety glasses while programming.
Post Reply