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 »

B-$hep wrote:So you don't like automatic codecompletion?
You like pressing Ctrl+Space each time?

Or you just want that Ctrl+Space will display the autocompletion list whenever you want?

Correct?
Read again, I guess you misunderstood him.

He said he would like to be able to use weapon names instead using COLLECT_XX in GENERATOR commands, and the weapon name would get replaced with their corresponding COLLECT_XX parameters when pressing Ctrl+Space, and mispad would write all the command when you press ctrl+space after writing just things like

Code: Select all

COLLECT pistol1
completing everything:

Code: Select all

COLLECT pistol1 = ( X.x , Y.y , Z.z ) 0 COLLECT_00 delay delay
with the coordinates selected so you can already write them
You just lost the game.
User avatar
B-$hep
Immortal
Posts: 568
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: GTA2 ScriptPad

Post by B-$hep »

OK, now i got it.

COLLECT_00 is actually pistol, according to docs.
COLLECT_01 is machine gun.
Do you really want to press Ctrl+Space each time to do that?

I think i could automate that.


And Gustavob these "delay delay", should really be strings: "delay" or they should be numbers or nothing at all?
If autocompletion inserts strings: delay delay, you have to select them manually and delete them and type in correct values.
I think there really could be some command templates that autocompletion inserts and later you just modify the values. Dunno what's better.
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:And Gustavob these "delay delay", should really be strings: "delay" or they should be numbers or nothing at all?
These are actually the minimum and maximum time delay for a generator to appear (not sure anyone actually uses different min and max here) and are integers.

Anyway, to me I find it slightly annoying if auto-complete fills in everything, making me go back and change variables. However, it is useful if you forget the command string for something!

Is it possible to do it Microsoft Excel (spreadsheet program) style when entering stuff? In Excel, when you start typing a formula it shows how the syntax should be as you're typing it, with the current bit your typing highlighted in bold then when you press space/comma it bolds the next variable etc until you reach the end. This way I feel is the "middle ground" between typing it manually and a full auto-complete with variables etc.

Of course, more eye-candy than anything else, I'm still used to the good old fashioned method of "remembering and/or looking commands up in documentation coding" method ;) Looking good so far!
User avatar
B-$hep
Immortal
Posts: 568
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: GTA2 ScriptPad

Post by B-$hep »

Pyro, i think it's similar to the small tooltips it displays right now whenever it expects some parameters. Maybe again, the strings / numbers "templates" should be used, so when you click on the first "delay" it's deleted and you can type in actual numeric value, etc.

I will think about it at work. I have more time to think there.

I also find it annoying that i have to go back to change stuff. It actually takes more time than manually typing IMO. But for Float X, Float Y, Float Z it's useful, if it goes back inside brackets, highlights every value in it and allows to change it immediately.

Atm, im messing around with stuff Ben suggested about generators.
I even got something to work already.

Soon...
Always wear safety glasses while programming.
User avatar
B-$hep
Immortal
Posts: 568
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: GTA2 ScriptPad

Post by B-$hep »

Ok, got something to work already


Something like this?
Image


It's automatic atm.
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 »

That's neat! :shock:

As Ben said (I think), could this also be done for vehicles too? For example, the "Z-Type" car is actually "VTYPE" in the scripting (along with loads of other names for cars). Of course, it would need to detect various typing/capitalisation of commands, such as:
  • ztype
  • z type
  • Ztype
  • ZType
  • Z Type
And so on. Each of those would turn into "VTYPE" for coding purposes. As you can see, there are a lot of cars and even more names!

Nice work 8-)

PS - The things I look up constantly are the remap colours of characters and cars, would it be possible to do some sort of palette? Again this is just convenience more than anything. Even if it's a separate window for reference it'd be cool (such as View -> Remaps or something).

Edit - I just noticed in your animation you forgot to type in the min and max delay for the generator :P Also, with this method of "auto correction", is it done after pressing space or enter? I would assume after pressing space so you could actually type in the timers.
User avatar
elypter
Immortal
Posts: 1120
Joined: 26 Dec 2009, 23:53
GH nick: elypter

Re: GTA2 ScriptPad

Post by elypter »

Pyro wrote: PS - The things I look up constantly are the remap colours of characters and cars, would it be possible to do some sort of palette? Again this is just convenience more than anything. Even if it's a separate window for reference it'd be cool (such as View -> Remaps or something).
someone could do something like this http://gta.wikia.com/Vehicles_in_GTA_2 for remaps.
yur sa'nok ngeyä
User avatar
T.M.
Immortal
Posts: 960
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: GTA2 ScriptPad

Post by T.M. »

elypter wrote:someone could do something like this http://gta.wikia.com/Vehicles_in_GTA_2 for remaps.
Thats few clicks job in my editor ;)

Just create 36 cars and set all remaps to them and place them in a nice row.

Here is my remap test code i have used when i made remaps possible in my editor:

Code: Select all

auto = CREATE_CAR (52.0, 6.0) 0 0 STYPE END
auto = CREATE_CAR (49.2, 4.6) 1 0 STYPE END
auto = CREATE_CAR (49.9, 4.6) 2 0 STYPE END
auto = CREATE_CAR (46.4, 4.6) 3 0 STYPE END
auto = CREATE_CAR (52.7, 3.2) 4 0 STYPE END
auto = CREATE_CAR (47.1, 6.0) 5 0 STYPE END
auto = CREATE_CAR (52.7, 6.0) 6 0 STYPE END
auto = CREATE_CAR (49.9, 6.0) 7 0 STYPE END
auto = CREATE_CAR (52.0, 4.6) 8 0 STYPE END
auto = CREATE_CAR (50.6, 3.2) 9 0 STYPE END
auto = CREATE_CAR (45.7, 3.2) 10 0 STYPE END
auto = CREATE_CAR (48.5, 3.2) 11 0 STYPE END
auto = CREATE_CAR (52.0, 3.2) 12 0 STYPE END
auto = CREATE_CAR (53.4, 4.6) 13 0 STYPE END
auto = CREATE_CAR (48.5, 4.6) 14 0 STYPE END
auto = CREATE_CAR (47.8, 4.6) 15 0 STYPE END
auto = CREATE_CAR (48.5, 6.0) 16 0 STYPE END
auto = CREATE_CAR (50.6, 4.6) 17 0 STYPE END
auto = CREATE_CAR (51.3, 4.6) 18 0 STYPE END
auto = CREATE_CAR (47.8, 3.2) 19 0 STYPE END
auto = CREATE_CAR (45.7, 6.0) 20 0 STYPE END
auto = CREATE_CAR (53.4, 6.0) 21 0 STYPE END
auto = CREATE_CAR (46.4, 3.2) 22 0 STYPE END
auto = CREATE_CAR (51.3, 6.0) 23 0 STYPE END
auto = CREATE_CAR (46.4, 6.0) 24 0 STYPE END
auto = CREATE_CAR (53.4, 3.2) 25 0 STYPE END
auto = CREATE_CAR (52.7, 4.6) 26 0 STYPE END
auto = CREATE_CAR (47.1, 4.6) 27 0 STYPE END
auto = CREATE_CAR (50.6, 6.0) 28 0 STYPE END
auto = CREATE_CAR (49.2, 6.0) 29 0 STYPE END
auto = CREATE_CAR (51.3, 3.2) 30 0 STYPE END
auto = CREATE_CAR (45.7, 4.6) 31 0 STYPE END
auto = CREATE_CAR (49.2, 3.2) 32 0 STYPE END
auto = CREATE_CAR (47.8, 6.0) 33 0 STYPE END
auto = CREATE_CAR (49.9, 3.2) 34 0 STYPE END
auto = CREATE_CAR (47.1, 3.2) 35 0 STYPE END
They appear in a nice box and colors somewhat sorted, was too lazy and handicapped to sort them better so, someone else may do it if they wish...

PS. i chose STYPE car because it has the remap best visible + has wide range of the colors visible.

Edit: i noticed the list has no gfx under the cars, nor shadows, luckily you can disable all those in my editor, i made example of the rendering output with big map image render tool:
Image
I just cropped the rendered area to the cars & enabled pixelized sprite textures and disabled shadows and map rendering off. Should be easy to separate each car into own image if it really has to be a GIF with transparent background...
User avatar
B-$hep
Immortal
Posts: 568
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: GTA2 ScriptPad

Post by B-$hep »

Pyro wrote:That's neat! :shock:
Thanks.
Pyro wrote:As Ben said (I think), could this also be done for vehicles too? For example, the "Z-Type" car is actually "VTYPE" in the scripting (along with loads of other names for cars). Of course, it would need to detect various typing/capitalisation of commands, such as:
...
And so on. Each of those would turn into "VTYPE" for coding purposes. As you can see, there are a lot of cars and even more names!
Seems like easy peasy japanesey. Because i work basically only with lowercase tokens.
I convert them all to lowercase, so it will not matter for the parser if it's like you said:
ztype, Ztype, ZType, ZtyPe, for parser, they are all the same.

Actually "z type" is incorrect, because of the space. I should ignore that because it's user's fault not mine. miss2 will complain anyway.

I could maybe fix small user typos, but if it's gonna be a spell checker then it will take forever to finish the editor.
PS - The things I look up constantly are the remap colours of characters and cars, would it be possible to do some sort of palette? Again this is just convenience more than anything. Even if it's a separate window for reference it'd be cool (such as View -> Remaps or something).
TM posted nice image, if he allows to use it, then i could include it. Maybe even in help file.
It's a bit BIG but maybe modified if i recreate it with TM editor.
Edit - I just noticed in your animation you forgot to type in the min and max delay for the generator :P
I know, i was in a hurry and actually it was only to show that i got it working.

Also, with this method of "auto correction", is it done after pressing space or enter? I would assume after pressing space so you could actually type in the timers.
Yes, space.
But i have to solve one (hopefully) problem with them. There could be more or less spaces before and after the commands. At the moment i assume that there is only one space between each command and brackets, etc...
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 »

Only problem with colours is some of them have really stupid names such as:
  • BrGreen (remap 5)
  • BSilver (remap 9)
  • BYellow (remap 10)
  • DRed (remap 17)
I would guess they are "bright green/silver/yellow" and "dark red" if they had proper names :roll: The one that makes me laugh is:
  • White (remap 33)
  • Whiter (remap 34)
If you want a list of car colours, you can check out my tutorial on it. If you decide to add this kind of feature, might as well just completely ignore the colour names or re-name them properly!

Also, I noticed you left out car remap 36 (interestingly called "zzgbank" - what?) which is a good thing as, supposedly, only Bank Vans can use that colour. However, Bank Vans only have 2 remaps anyway (one is slightly blue and the other slightly green). To be honest, I don't think I've ever scripted Bank Vans in any of my coding ;)

Edit - as TM and I found out, some remaps (namely car remap 0) show default colour, check this post (and the one below) for info on it. Character remaps are also separate colours which I included somewhere in that post too (about graphics being different for characters being dummy/gang/emergency graphic type).
User avatar
T.M.
Immortal
Posts: 960
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: GTA2 ScriptPad

Post by T.M. »

B-$hep wrote:TM posted nice image, if he allows to use it, then i could include it. Maybe even in help file.
It's a bit BIG but maybe modified if i recreate it with TM editor.
Well, i dont own the rights on GTA2 sprites, so feel free to rape em as much as you can! :D you just have to add the remap numbers there which may take a while.
Pyro wrote:If you want a list of car colours, you can check out my tutorial on it.
Theres still the -1 / 0 error: -1 is same as zero, which isnt blue, but the default color, you should fix that ;)
Pyro wrote:Also, I noticed you left out car remap 36 (interestingly called "zzgbank" - what?) which is a good thing as, supposedly, only Bank Vans can use that colour. However, Bank Vans only have 2 remaps anyway (one is slightly blue and the other slightly green).
You cannot use the 36 remap on any cars, not even bankvans, only the GTA2 traffic generator can spawn those, i re-cheched now, and using remap 36 shows the same remap as with zero remap.

Interestingly enough, the traffic generator never spawns the cop cars with that remap... i guess the list of cars that can have different remaps spawned on traffic is hardcoded in GTA2.
User avatar
B-$hep
Immortal
Posts: 568
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: GTA2 ScriptPad

Post by B-$hep »

Another colorful example:
Image

There are again problems with that stuff:
COLLECT_01 is machine gun
COLLECT_18 // car - machine gun

If user wants car MG it types in machine gun, but editor put's in COLLECT_01.
So user must include some prefix or something, so editor will actually know what user wants exactly.

Any ideas to share?
Last edited by B-$hep on 11 Mar 2013, 01:07, edited 2 times in total.
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. »

B-$hep wrote:If user wants car MG it types in machine gun, but editor put's in COLLECT_01.
So user must include some prefix or something, so editor will actually know what user wants exactly.

Any ideas to share?
how about you type carmachinegun instead of machineguncar?
User avatar
B-$hep
Immortal
Posts: 568
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: GTA2 ScriptPad

Post by B-$hep »

That should work but i think it also should be mentioned in docs.
Because otherwise it will be like bug: user wanted actually COLLECT_18 (car machine gun) but editor replaced machinegun with COLLECT_01.

By just typing COLLECT_18 manually. editor of course will not change anything.

In DMA docs there are COLLECT_XX which have no description, like:

Code: Select all

COLLECT_00			// pistol
COLLECT_01			// machine gun
COLLECT_02			// rocket launcher
COLLECT_03			// electro gun
COLLECT_04			// molotov
COLLECT_05			// grenade
COLLECT_06			// shotgun
COLLECT_07			// 
COLLECT_08			// flame thrower
COLLECT_09			// silenced machine gun
COLLECT_10			// dual pistol 
COLLECT_11			//			
COLLECT_12			// 
COLLECT_13			//
COLLECT_14			// 
COLLECT_15			// car - car bomb
COLLECT_07, COLLECT_11 etc.
I can just ignore them? They do nothing?
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. »

You can look at the names in my editor, it shows "unused collectible", "unused vehicle collectibe" and "unused powerup" for almost all of those letter collectibles, as far as i know, those cannot be used in any way... so you should just ignore them.

Image

collect_07 = electro baton.. also shown in my editor. oh same with car names, also shown in my editor ;)
User avatar
Pyro
Immortal
Posts: 414
Joined: 17 Mar 2010, 04:07
GH nick: Pyro
Location: Wales, UK

Re: GTA2 ScriptPad

Post by Pyro »

Yup, TradeMark nailed that one - the other COLLECT_XX are the electro baton and the weird coloured letters. Also, there is also the MOVING_COLLECT_XX powerups too, although not really sure what they are for - probably conveyors or something.

As for typing machine gun for generator, I usually abbreviate it to just "mg" (and name each one "mg01", "mg02" etc). Could use "machinegun" if needs be, don't really have a problem with either. However, the car machine gun I would like to be able to type "carmg", though I don't really mind!
User avatar
T.M.
Immortal
Posts: 960
Joined: 29 Jan 2010, 15:00
Location: F21B3EED

Re: GTA2 ScriptPad

Post by T.M. »

Pyro wrote:Also, there is also the MOVING_COLLECT_XX powerups too, although not really sure what they are for - probably conveyors or something.
Moving collectibles move along conveyor lines and they can also fall down if set in mid-air, or if block is destroyed under them etc.. non-moving collectibles are always in the position you put them.
BenMillard
Immortal
Posts: 889
Joined: 16 May 2009, 06:14
GH nick: BenMillard
Location: London, UK
Contact:

Re: GTA2 ScriptPad

Post by BenMillard »

B-$hep, this is exciting progress. The tooltip is very cool but could it be anchored to the start of the word being typed?

Triggers for Completion
Using simple Space to complete when there's only 1 option is fine. Space could be used for showing a list of options, when the current location is ambiguous. It would still type the space but if you just continue typing, the list goes away since you are now writing the next parameter.

Maybe Ctrl+Space would show a list with all possible items for the current position. Useful when you know there will be multiple options and might want to type a 3rd or 4th letter to filter it down a bit further. If the list only has one item, it would autocomplete as if you pressed Space.

Esc should dismiss the list without applying its selected item. Return would dismiss the list after accepting its selected item.

Common Names
I suggested you research a variety of existing .mis files to see what short and logical names most people give to weapons. "vmg" is commonly typed in-game for "Vehicle Machine Guns". The comment it adds at the end should use the text GTA2 displays in-game - that part is missing from your demo.

Syntax Completion
Driving the weapon type directly from the GENERATOR weapon name would be super handy. Otherwise you're typing the same thing twice - once for name, then once more for weapon type.

If weapon name matches weapon type then the comment can be left out.

Simple default numbers could be used instead of placeholder text. For example, most weapon types would use 0 0 99 for delay delay ammo. Certain pickups which can be picked up immediately should have a longer delay and no ammo. As examples: Health, Armour, Multipler Plus One, Instant Gang and so forth can use either 120 120 or 200 200 depending on the length of the announcement. (Check my scripts for timings.)

As you say, a spellchecker is out of scope. But various naming and syntax convenience features will help us a lot.
User avatar
B-$hep
Immortal
Posts: 568
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: GTA2 ScriptPad

Post by B-$hep »

BenMillard wrote:The tooltip is very cool but could it be anchored to the start of the word being typed?
You mean something like this?
Image

BenMillard wrote:The comment it adds at the end should use the text GTA2 displays in-game - that part is missing from your demo.
Sorry, i totally forgot.
Thanks for all the other suggestions, at least i got the direction to move.
Always wear safety glasses while programming.
User avatar
B-$hep
Immortal
Posts: 568
Joined: 24 Apr 2009, 21:43
GH nick: B-Shep
Location: EU

Re: GTA2 ScriptPad

Post by B-$hep »

When you got some bad symbol or string in script source and you try to compile it, you will get of course error.
But now you can directly jump to that bad symbol by double clicking on it in output window and ScriptPad will highlight it, which allows you to immediately edit or delete it:

Image

Oh, i got 220V with my 220 posts :)
Last edited by B-$hep on 11 Mar 2013, 01:09, edited 1 time in total.
Always wear safety glasses while programming.
Post Reply