script_helpdeveloperdeveloperscript_help

developer 3
map de_nuke
developer 0
con_logfile dump.log
script_help
con_logfile ""

变量

Entities

常量

_charsize__floatsize__intsize__version__versionnumber_RAND_MAXPI

CBaseEntity

CBaseEntity是实体的脚本句柄类. 所有已生成的实体都有一个使用CBaseEntity或者其子类的的脚本句柄.

self

方法

__KeyValueFromIntvoid __KeyValueFromInt(string key, int value)__KeyValueFromFloatvoid __KeyValueFromFloat(string key, float value)__KeyValueFromStringvoid __KeyValueFromString(string key, string value)__KeyValueFromVectorvoid __KeyValueFromVector(string key, Vector value)ConnectOutputvoid ConnectOutput(string output, string function)DisconnectOutputvoid DisconnectOutput(string output, string function)Destroyvoid Destroy()EmitSoundvoid EmitSound(string soundScript)entindexint entindex()EyePositionVector EyePosition()FirstMoveChildhandle FirstMoveChild()GetAnglesVector GetAngles()GetAngularVelocityVector GetAngularVelocity()GetBoundingMaxsVector GetBoundingMaxs()GetBoundingMaxsOrientedVector GetBoundingMaxsOriented()GetBoundingMinsVector GetBoundingMins()GetBoundingMinsOrientedVector GetBoundingMinsOriented()GetCenterVector GetCenter()GetClassnamestring GetClassname()playerGetForwardVectorVector GetForwardVector()GetHealthint GetHealth()GetLeftVectorVector GetLeftVector()GetMaxHealthint GetMaxHealth()GetModelKeyValuesKeyvalues GetModelKeyValues()GetModelNamestring GetModelName()GetMoveParentCBaseEntity GetMoveParent()GetNamestring GetName()GetOriginVector GetOrigin()GetOwnerhandle GetOwner()GetPreTemplateNamestring GetPreTemplateName()GetRootMoveParenthandle GetRootMoveParent()GetScriptIdstring GetScriptId()GetScriptScopehandle GetScriptScope()GetSoundDurationfloat GetSoundDuration(string soundName, string actorModelName = "")GetTeamint GetTeam()GetUpVectorVector GetUpVector()GetVelocityVector GetVelocity()IsValidbool IsValid()NextMovePeerhandle NextMovePeer()PrecacheModelvoid PrecacheModel(string modelPath)PrecacheScriptSoundvoid PrecacheScriptSound(string soundName)PrecacheSoundScriptvoid PrecacheSoundScript(string soundScript)SetAbsOriginvoid SetAbsOrigin(Vector position)SetAnglesvoid SetAngles(float pitch, float yaw, float roll)SetAngularVelocityvoid SetAngularVelocity(float pitch, float yaw, float roll)SetForwardVectorvoid SetForwardVector(Vector forwardVector)SetHealthvoid SetHealth(int newHealth)SetMaxHealthvoid SetMaxHealth(int maxHealth)SetModelvoid SetModel(string modelName)SetOriginvoid SetOrigin(Vector position)SetOwnervoid SetOwner(handle owner)SetSizevoid SetSize(Vector, Vector)SetTeamvoid SetTeam(int teamNumber)SetVelocityvoid SetVelocity(Vector velocity)StopSoundvoid StopSound(String soundname)ValidateScriptScopebool ValidateScriptScope()

Hooks

如果其中一个函数在实体脚本中被声明, 实体将在适当的情况下自动运行此函数.

InputInputNamebool InputInputName()InputInputFireUser1activatorcallertruefalseOnPostSpawnvoid OnPostSpawn()Precachevoid Precache()

CBaseAnimating

动画实体(如props)的脚本句柄类.

Methods

GetAttachmentAnglesVector GetAttachmentAngles(int id)GetAttachmentOriginVector GetAttachmentOrigin(int 'id')IsSequenceFinishedbool IsSequenceFinished()LookupAttachmentint LookupAttachment(string attachmentName)SetBodygroupvoid SetBodygroup(int groupIndex, int value)

CBaseFlex

Methods

GetCurrentScenehandle GetCurrentScene()GetSceneByIndexhandle GetSceneByIndex(int index)

CBasePlayer

Methods

IsNoclippingbool IsNoclipping()

CBaseMultiplayerPlayer

CSGO玩家的脚本句柄类,无附带方法。


CEnvEntityMaker

env_entity_maker的脚本句柄类.

Methods

SpawnEntityvoid SpawnEntity()SpawnEntityAtEntityOriginvoid SpawnEntityAtEntityOrigin(CBaseEntity entity)SpawnEntityAtLocationvoid SpawnEntityAtLocation(Vector origin, Vector orientation)SpawnEntityAtNamedEntityOriginvoid SpawnEntityAtNamedEntityOrigin(string targetName)

CFuncTrackTrain

Methods

GetFuturePositionVector GetFuturePosition(float, float)

CGameCoopMissionManager

Methods

GetWaveNumberint GetWaveNumber()

CHostage

Methods

IsBeingCarriedbool IsBeingCarried()


CPointTemplate

point_template的脚本句柄类.

Hooks

table PreSpawnInstance(string entityClass, string entityName)
void PostSpawn(table entities)


CSceneEntity


Methods

AddBroadcastTeamTargetvoid AddBroadcastTeamTarget(int index)EstimateLengthfloat EstimateLength()FindNamedEntityhandle FindNamedEntity(string reference)IsPausedbool IsPaused()IsPlayingBackbool IsPlayingBack()LoadSceneFromStringbool LoadSceneFromString(string sceneName, string scene)RemoveBroadcastTeamTargetvoid RemoveBroadcastTeamTarget(int index)


CTriggerCamera


Methods

GetFovint GetFov()SetFovvoid SetFov(int fov, float rate)

Hooks

void ScriptStartCameraShot(string shotType, handle sceneEntity, handle actor1, handle actor2, float duration)


CCallChainer

Todo

Methods

constructorTodo constructor()PostScriptExecuteTodo PostScriptExecute()CallTodo Call()

Members

chainsnullprefixnullscopenull


CEntities

Entities
null
local ent = null;
while ( ent = Entities.FindByClassname(ent, "weapon_*") )
{
  // ...
}
for (local ent; ent = Entities.FindByName(ent, "weapon_*"); )
{
  // ...
}

方法

CreateByClassnamehandle CreateByClassname(string class)FindByClassnamehandle FindByClassname(handle previous, string class)FindByClassnameNearesthandle FindByClassnameNearest(string class, Vector origin, float radius)FindByClassnameWithinhandle FindByClassnameWithin(handle previous, string class, Vector origin, float radius)FindByModelhandle FindByModel(handle previous, string filename)FindByNamehandle FindByName(handle previous, string name)FindByNameNearesthandle FindByNameNearest(string name, Vector origin, float radius)FindByNameWithinhandle FindByNameWithin(handle previous, string name, Vector origin, float radius)FindByTargethandle FindByTarget(handle previous, string targetname)FindInSpherehandle FindInSphere(handle previous, Vector origin, float radius)Firsthandle First()Nexthandle Next(handle previous)IsValidbool IsValid()

CPlayerVoiceListener

方法

GetPlayerSpeechDurationfloat GetPlayerSpeechDuration(int)IsPlayerSpeakingbool IsPlayerSpeaking(int)IsValidbool IsValid()

CScriptKeyValues

代表一个模型的$keyvalues块的脚本句柄. 子键是同一类的实例.

Methods

constructorFindKeyCScriptKeyValues FindKey(string keyName)GetFirstSubKeyCScriptKeyValues GetFirstSubKey()GetKeyBoolbool GetKeyBool(string keyName)GetKeyFloatfloat GetKeyFloat(string keyName)GetKeyIntint GetKeyInt(string keyName)GetKeyStringstring GetKeyString(string keyName)GetNextKeyhandle GetNextKey()IsKeyEmptybool IsKeyEmpty(string keyName)IsValidbool IsValid()ReleaseKeyValuesvoid ReleaseKeyValues()


CSimpleCallChainer

看上去似乎和 CCallChainer 有相同的Members. Todo


LateBinder =

Late binding: allows a table to refer to parts of itself, it's children, it's owner, and then have the references fixed up after it's fully parsed.

When End() is called, all of the unresolved symbols in the tables and arrays will be resolved, any left unresolved will become a string prepended with '~', which later code can deal with.


Methods

BeginEndEstablishDelegationHookRootMetamethodLogm_bindNamesStackm_fixupSetm_logm_logIndentm_targetTableRemoveDelegationResolveUnhookRootMetamethod

regexp

正则表达式的内置Squirrel 类.

Methods

constructorregexp()capture [table] capture(str, [start])match bool match(str)searchtable search(str, [start])subexpcount


Vector

Squirrel的Vector类与C++相当.

三维向量用向量值和标量值重载了算术运算.

Methods

constructorVector(float x, float y, float z)Crossfloat Cross(Vector factor)Dotfloat Dot(Vector factor)Lengthfloat Length()LengthSqrfloat LengthSqr()Length2Dfloat Length2D()Length2DSqrfloat Length2DSqr()Normfloat Norm()ToKVStringstring ToKVString()

Members

xfloatyfloatzfloat

全局函数

打印与绘制

DebugDrawBoxvoid DebugDrawBox(vector origin, vector min, vector max, int r, int g, int b, int alpha, float duration)DebugDrawLinevoid DebugDrawLine(Vector start, Vector end, int red, int green, int blue', bool zTest, float time)Msgvoid Msg(string message)printprintvoid print(string message)printlvoid printl(string message)ScriptPrintMessageCenterAllWithParamsvoid ScriptPrintMessageCenterAllWithParams(string, string, string, string)ScriptPrintMessageCenterAllvoid ScriptPrintMessageCenterAll(string message)ScriptPrintMessageCenterTeamvoid ScriptPrintMessageCenterTeam(int, string)ScriptPrintMessageChatAllvoid ScriptPrintMessageChatAll(string message)ScriptPrintMessageChatTeamvoid ScriptPrintMessageChatTeam(int teamNumber, string message)ShowMessagevoid ShowMessage(string)__DumpScopevoid __DumpScope(int indentation, handle scope)

训练课程相关

ScriptGetBestTrainingCourseTimeint ScriptGetBestTrainingCourseTime()ScriptGetPlayerCompletedTrainingbool ScriptGetPlayerCompletedTraining()ScriptGetValveTrainingCourseTimeint ScriptGetValveTrainingCourseTime()ScriptHighlightAmmoCountervoid ScriptHighlightAmmoCounter()ScriptSetBestTrainingCourseTimevoid ScriptSetBestTrainingCourseTime(int bestTime)ScriptSetMiniScoreHiddenvoid ScriptSetMiniScoreHidden(bool scoreHidden)ScriptSetPlayerCompletedTrainingvoid ScriptSetPlayerCompletedTraining(bool trainingCompleted)ScriptShowExitDoorMsgvoid ScriptShowExitDoorMsg()ScriptShowFinishMsgBoxvoid ScriptShowFinishMsgBox()ScriptTrainingGivePlayerAmmovoid ScriptTrainingGivePlayerAmmo()

合作模式相关

ScriptCoopCollectBonusCoinvoid ScriptCoopCollectBonusCoin()ScriptCoopGiveC4sToCTsvoid ScriptCoopGiveC4sToCTs(int)ScriptCoopMissionGetMissionNumberint ScriptCoopMissionGetMissionNumber()ScriptCoopMissionRespawnDeadPlayersvoid ScriptCoopMissionRespawnDeadPlayers()ScriptCoopMissionSetNextRespawnInvoid ScriptCoopMissionSetNextRespawnIn(float, bool)ScriptCoopMissionSpawnFirstEnemiesvoid ScriptCoopMissionSpawnFirstEnemies(int)ScriptCoopMissionSpawnNextWavevoid ScriptCoopMissionSpawnNextWave(int)ScriptCoopResetRoundStartTimevoid ScriptCoopResetRoundStartTime()ScriptCoopSetBotQuotaAndRefreshSpawnsvoid ScriptCoopSetBotQuotaAndRefreshSpawns(int)

其他

Assertvoid Assert(bool value, string optional message)CreateProphandle CreateProp(string class, Vector origin, string model, int animation)CreateSceneEntityCSceneEntity CreateSceneEntity(string scene)DispatchParticleEffectvoid DispatchParticleEffect(string particleName, Vector, Vector)DoIncludeScriptbool DoIncludeScript(string filename, table scope)DoEntFirevoid DoEntFire(string target, string action, string value, float delay, handle activator, handle caller)EntFirefunction EntFire(string target, string action, string value, float delay = 0.0, handle activator = null)EntFireByHandlevoid EntFireByHandle(handle target, string action, string 'value, float delay, handle activator, handle caller)FrameTimefloat FrameTime()GetDeveloperLevelint GetDeveloperLevel()GetMapNamestring GetMapName()LoopSinglePlayerMapsbool LoopSinglePlayerMaps()PrintHelpRandomFloatfloat RandomFloat()RandomFloatfloat RandomFloat(float min, float max)RandomIntint RandomInt()RandomIntint RandomInt(int min, int max)RecordAchievementEventvoid RecordAchievementEvent(string, int)RetrieveNativeSignaturevoid RetrieveNativeSignature(string or func)ScriptGetGameModeint ScriptGetGameMode()ScriptGetGameTypeint ScriptGetGameType()ScriptGetRoundsPlayedint ScriptGetRoundsPlayed()ScriptIsLocalPlayerUsingControllerbool ScriptIsLocalPlayerUsingController()ScriptIsWarmupPeriodbool ScriptIsWarmupPeriod()ScriptSetRadarHiddenvoid ScriptSetRadarHidden(bool hideRadar)SendToConsolevoid SendToConsole(string command)SendToConsoleServervoid SendToConsoleServer(string)Timefloat Time()TraceLinefloat TraceLine(Vector, Vector, handle)UniqueStringfunction UniqueString(string)__ReplaceClosures

推荐阅读