Page 1 of 1

Mit, Scripting?

Posted: Fri Sep 07, 2018 10:45 pm
by zaroba
Just wondering what, if any, changes have been made to the scripting system since the old game.

Re: Mit, Scripting?

Posted: Sat Sep 08, 2018 6:24 pm
by Mit
Quite a bucketload of new stuff.. not sure how far back we need to go.. :]
Will take me a while to update all the docs for it, but here's a random grab from some of the code lists that have been added in the past few months..

Events :
"EntityDestroyed", "EntityDamaged", "EntityPickup", "EntityUpdate", "ProductionRunStart", "ProductionRunEnd", "PickupBuilding","KillWildlife","FireWeapon","WorldUpdate", "BuildingDamaged", "WeaponHitGround","WeaponHitPlayer", "MapClick","OnTheHour", "TenToTheHour", "FiveToTheHour", "CrowFlagTouch", "CrowFlagTouchAny", "CrowExit", "Subgame", "HarvestDay","RaceStart", "RaceEnd", "FlagPickup","FlagCapture","HornballGoal","EnterGameZone","ExitGameZone", "SubgameChallengeStart", "SubgameChallengeCountdownStart", "DayOfYear","ViewTournament", "RaceWinner"
Sys functions :
"sysGetNearestPlayer","sysGetSecondaryConstructionPrice", "sysIsInBuildZone", "sysIsInNoBuildZone", "sysIsInScriptZone", "sysAddWealth","sysRemoveWealth", "sysConstructBuilding", "sysGetCrowFlagState", "sysSetCrowFlagState", "sysGetPlayerListScore", "sysNumPlayersInRCMode", "SubgameGetStat", "SubgameGetNumPlayers", "SubgameGetNumPlayersOnTeam", "SubgameIncrementStat", "SubgameDecrementStat", "SubgameGetTimerRemaining", "SubgameGetScore", "SubgameGetHighestPlayerListScore", "SubgameNumPlayersWithPlayerListScore", "SubgameGetPlayerWithPlayerListScore", "SubgameIsPlayerInGame", "SubgameGetPlayer", "SubgameChallengeGetPlayer", "sysNumPlayersInBuildZone","sysNumPlayersInScriptZone", "sysNumPlayersWithPlayerVarVal", "sysGenerateTopPlayerVarsList","sysGetTopPlayer", "sysGetExportPrice", "EntityCreate", "EntityAddToWorld", "EntitySetPosition", "EntitySetRotation", "EntitySetModel", "EntitySetAnimation", "EntityMoveTo", "EntitySetBehaviour", "EntityDelete", "EntityDeleteAll", "EntityCommandCode", "EntitySetValue","EntitySetControlFlag", "EntityActivateUpdateEvent","EntitySetGraphics",
"SubgameJoin", "SubgameLeave", "SubgameEventAll", "SubgameMessageAll","SubgameSoundAll", "SubgameEventTeam","SubgameMessageTeam", "SubgameSoundTeam","SubgameSetStat", "SubgameSetTimer", "SubgameKillTimer", "SubgameReset", "SubgameRegisterEvent", "SubgameActivateScoreboard", "SubgameSetScore", "SubgameIncrementScore","SubgameActivatePlayerListScores","SubgameActivateUI", "SubgameWebpostDuelScore", "sysBuildingActivateStockroom", "sysBuildingActivateBuyItem", "sysBuildingActivateSetPrices", "sysBuildingActivateSellItem"
New globals:
"gPlayerCrowX", "gPlayerCrowY","gBuildingDamage", "gBuildingTeam", "gEventWorldX", "gEventWorldY",
"gPlayerRot", "gClickX", "gClickY", "gPlayerNetWorth", "gBuildingCapacity", "gBuildingSpaceRemaining", "gNumTowns","gTotalMoneySupply","gGlobalAverageWealth", "gNumAlive"
OSD Elements:
"BLINKINGWARNINGTEXT", "EXITIMAGE", "SLIDER", "AMOUNTPRICEVALUE", "COUNTDOWN", "LAYERRECT"
Other bits and pieces :
  • New subgame system ; (as used by all the bongochimp games, and the RC KOTH and Duel games).. this is a helper system that lets you easily add players to a subgame/group, and then trigger events and messages for all the players in the subgame/group. Server auto-handles the removal of players from the subgame/group when they leave and etc.
  • Lotsa additions to the entity controls - some of the bongochimp games uses entities (e.g. pickup entities for the crates).
  • Not sure if we had the keyvalue system last time you were about? You can create stored variables just by name now, e.g. "$gServerKey[Brian] = 1" (automatically creates a new stored variable called 'Brian' ) - similar per-player system on $gPlayerKey
  • Supports += , -= etc
  • Now supports variable function indirection.. e.g. can do things like..

    Code: Select all

    $maFunctionList[] = 
    {
         "MyFunc",   "MyOtherFunc",   "AThirdFunc"
    }
    
    $callFunc = $maFunctionList[$inputVal]
    $callFunc()
    
    which is very useful for certain things :)
  • You can also pass arrays as variables now - I use that a lot on current servers.. for instance theres just one function for all the different skills, and each skill just has an (easily updated) array defining the skill names, prices, descriptions etc that is passed into the 'DisplaySkillList' function.
  • And of course theres a pile of new * server commands too ; e.g. *eventallinscriptzone [zoneIDnum] [eventname] [params], *subgamedebug, subgamereset [subgamenum], *flagsetcapturedest [flagnum] [buildingnum], *setplayerlistscore [player] [score],*setallplayervar [playervarNum] [value]
Well you did ask :)

Re: Mit, Scripting?

Posted: Mon Sep 10, 2018 11:49 pm
by zaroba
Lots of nice stuff. I still have to figure out how to use Arrays.
Is it safe to assume there havn't been any syntex changes?
Still 128 building and server vars and 64 player vars?

I've been working on the scripts I had been making for Zoric before player worlds went away, hoping to have them ready before the hopeful return of player owned worlds. Have the servers and clients from that time but unfortunatly there doesn't seem to be a way to do a local connection for testing.

Re: Mit, Scripting?

Posted: Sat Sep 15, 2018 10:55 pm
by Morvis
after a quick glance over that list of script goodness I have one question off the top of my head --

Does this work yet?:

event("killwildlife","wildlifetype#")

Re: Mit, Scripting?

Posted: Sun Sep 16, 2018 6:51 am
by Mit
yup, i used that on aramathea to award people 'Hides' when they speared a 'cow-thing'.

Re: Mit, Scripting?

Posted: Sun Sep 16, 2018 4:30 pm
by Morvis
can we get a setting on weapons where certain weapon can only kill a certain wildlife type as well? =)