PDA

View Full Version : Scripting suggestions


tuntis
03-28-2009, 01:40 PM
VCO's server scripting engine is great and allows for a lot of great stuff, especially when compared to MTA/VC-MP's horrid scriptability options. But I have 2 suggestions to consider for future releases, and would like some comment from others:

A more object-oriented approach

For example, the player functions. Currently, for example, you would set a player drunk like this (assuming the player ID is #5):
togglePlayerDrunk(5, true)

Simple? Yes. But what if it would be like this instead:
p = Player(5) // Creates a new Player object that fetches player #5
p.toggleDrunk(true) // Sets the player into drunk mode

I know what you're thinking - seems more complicated, right? But an object-oriented approach is cleaner. Modern programming & scripting languages use OOP patterns. Furthermore, if we'd assume there would be a /drunk command to make a player drunk, like this:

function MakePlayerDrunk(PlayerID)
togglePlayerDrunk(PlayerID, true)
end

What if PlayerID would be replaced by a Player object instead? The above code would become this:
function MakePlayerDrunk(PlayerID)
PlayerID.toggleDrunk(true)
end

I think that an object-oriented design pattern (buzzwords, hooray!) would make scripting easier and cleaner. Juggling around Player ID's in code can get far more messier than a Player object, IMO.

Replacing the current MySQL commands with LuaSQL
LuaSQL (http://www.keplerproject.org/luasql/) is a Lua library designed for database access. I think integrating this with VCO would be easier for both sides - no need to write own MySQL commands, but instead just provide basic documentation for a grown, mature DBMS interface library.

Note that I'm not criticizing VCO in any way - the current scripting possibilities are great, but I personally feel that this could be done to make it even better. Your thoughts?

Ettans
03-28-2009, 02:18 PM
Seems great, I like it. Great idea tuntis. ;)

Boylett
03-29-2009, 12:02 PM
Extensions arent needed. I found out dofile works just as well (infact better) because commands dont work in Extensions, but they do with dofile (thanks to whoever tested it cant remember name Ettans)

dofile "Extensions/blah.lua"

Also, you can call functions between include files

Ettans
03-30-2009, 05:51 AM
Yeah, I couldn't get any commands to work with Extensions, until Boylett suggested me to use 'dofile'. Thanks ;)

Ghost Dog 13
03-30-2009, 03:07 PM
:S

Strange...

Commands in Extensions work good here :S

Boylett
03-31-2009, 02:55 PM
Maybe a good idea for the next version: implement loadlib
http://www.lua.org/pil/8.2.html
I tried it but it said the function was nil

Mex
03-31-2009, 10:19 PM
togglePlayerBlip(playerID PlayerID, boolean Shown)
The above function would show/hide a player's dot in the mini-map and pause-menu-map.
Would be good for team deathmatch modes.

Also it would be awesome to have socket functions available.
One benefit of having this would make transfering data to/from php/asp alot easier.

Boylett
04-01-2009, 12:39 PM
Add a callback for when a player uses an unknown command or not the right amount of parameters

Mantis
04-05-2009, 04:28 AM
I'd like to see the object functions expanded. I've been looking at a revamp of Vice City, it'd be great in multiplayer! I've been manually constructing new models and areas, and when I've tested ingame it either doesn't work, or it's not in the right place. Any chance we could get xyzw floats instead of just xyz ones. It'll make life a lil easier!

Ettans
04-05-2009, 08:07 AM
I think a spectating function would be great for VCO, for both players and administrators.

togglePlayerSpectating(PlayerID,boolean:true/false )
playerSpectatePlayer(PlayerID,TargetID)
playerSpectateVehicle(PlayerID,VehicleID)

jakethegunner
04-09-2009, 09:23 PM
i wish it was possible to not be forced to the spawn menu could do many more things and game modes

and people could make their own

:)

Warr1or
04-20-2009, 04:33 AM
1. make "reconnect(PlayerID)". Cause when changing spawn menu it doesn't have effect before client quit and join (and recent new data)

2. setPlayerAnimation should have more parameters. Such as loop on/off, freeze after animation on/off

3. new feature for cars - toggleVehicleJump(VehicleID,1) . Like in singleplayer after finishing Taxi mission You can jump pressing a button

4. setStaticActorWalk(ACtorID, x,y,z) - makes actor walk to x y z
giveStaticActorWeapon(ActorID,weaponid)
setStaticActorShoot(ActorID,x,y,z,toggle,Time) - actor shoots at point x y z, Time in mscs, if -1 then infinite before tg off
putStaticActorInVehicle(ActorID,vehicleID)
setStaticActorDriveVehicle(ActorID,VehicleID,x,y,z )

5.attachObjectToPlayer

Mantis
04-23-2009, 09:59 PM
Bumped - Any other cool features you'd like to see in VCO? The next RC build is looking pretty awesome at the moment, why not make it even better with more functionality!

Warr1or
04-24-2009, 03:24 AM
clearExData() - removes data from all extensions. And remains only Main's data.

toggleDriveBys() - Disabled if false.