Javascript API documentation
Re: Javascript API documentation
No, not yet.
Why not?
Why not?
Re: Javascript API documentation
Just a niggling doubt - I think it's the fact that removeTimer() not only removes setTimer() invocations of the function, but also those set with queue(). There's a degree of ambiguity about it.
Would the auto-culling of duplicate triggers apply to both repeating and non-repeating calls?
EDIT: BTW, being able to return false from the invoked function to cancel a timer sounds like a good idea.
Would the auto-culling of duplicate triggers apply to both repeating and non-repeating calls?
EDIT: BTW, being able to return false from the invoked function to cancel a timer sounds like a good idea.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
Re: Javascript API documentation
I can`t find location of script that generates js api docs html.
http://addons.wz2100.net/ developer
Re: Javascript API documentation
Here's part of it: https://github.com/Warzone2100/warzone2 ... script.tex
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
Re: Javascript API documentation
I got 2 troubles with findResearch
I start skrimish game with nullbot (both todays master)
Get enumResearch
I call findResearch('R-Defense-MortarPit') this research can be researched.
But I got 2 techs
Trying to run findResearch('R-Wpn-Howitzer-Incenediary') crushes game.
log (it just little longer then inside crush info):
I start skrimish game with nullbot (both todays master)
Get enumResearch
Code: Select all
[{"power":37,"points":1200,"started":false,"done":false,"name":"R-Cyborg-Metals01","type":8},
{"power":56,"points":1800,"started":false,"done":false,"name":"R-Defense-HardcreteGate","type":8},
{"power":37,"points":1200,"started":false,"done":false,"name":"R-Defense-MortarPit","type":8},
{"power":37,"points":1200,"started":false,"done":false,"name":"R-Defense-WallUpgrade01","type":8},
{"power":75,"points":2400,"started":false,"done":false,"name":"R-Struc-Factory-Upgrade01","type":8},
{"power":37,"points":1200,"started":false,"done":false,"name":"R-Struc-Research-Upgrade01","type":8},
{"power":37,"points":1200,"started":false,"done":false,"name":"R-Sys-Sensor-Tower02","type":8},
{"power":75,"points":2400,"started":false,"done":false,"name":"R-Vehicle-Engine02","type":8},
{"power":56,"points":1800,"started":false,"done":false,"name":"R-Vehicle-Metals01","type":8},
{"power":112,"points":3600,"started":false,"done":false,"name":"R-Wpn-AAGun03","type":8},
{"power":37,"points":1200,"started":false,"done":false,"name":"R-Wpn-Cannon-Damage01","type":8},
{"power":18,"points":600,"started":false,"done":false,"name":"R-Wpn-Flamer-Damage01","type":8},
{"power":37,"points":1200,"started":false,"done":false,"name":"R-Wpn-MG-Damage02","type":8},
{"power":56,"points":1800,"started":false,"done":false,"name":"R-Wpn-Mortar-Damage01","type":8},
{"power":75,"points":2400,"started":false,"done":false,"name":"R-Wpn-Rocket-Damage02","type":8}]
I expect blank list or may be list with current tech (I don`t get it from description).Return list of research items remaining to research for the given research item. (3.2+ only)
But I got 2 techs
Code: Select all
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Defense-MortarPit for R-Defense-MortarPit
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Cannon-Damage01 for R-Defense-MortarPit
[{"power":37,"points":1200,"started":false,"done":false,"name":"R-Defense-MortarPit","type":8},{"power":37,"points":1200,"started":false,"done":false,"name":"R-Wpn-Cannon-Damage01","type":8}]
log (it just little longer then inside crush info):
Code: Select all
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Howitzer-Incenediary for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Flame2 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Flamer-Damage04 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Flamer-Damage03 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Flamer-Damage02 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Flamer-Damage01 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Howitzer-Damage03 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Howitzer-Damage02 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Howitzer-Damage01 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-HowitzerMk1 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage04 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar02Hvy for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Vehicle-Metals01 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-HvyHowitzer for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Howitzer-Damage02 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Howitzer-Damage01 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-HowitzerMk1 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage04 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar02Hvy for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Vehicle-Metals01 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Sys-Sensor-Upgrade01 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Struc-Research-Upgrade04 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Struc-Research-Upgrade03 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Struc-Research-Upgrade02 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Struc-Research-Upgrade01 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage03 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage02 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage01 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Cannon-Damage01 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage02 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage01 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Cannon-Damage01 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-HowitzerMk1 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage04 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar02Hvy for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Vehicle-Metals01 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Sys-Sensor-Upgrade01 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Struc-Research-Upgrade04 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Struc-Research-Upgrade03 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Struc-Research-Upgrade02 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Struc-Research-Upgrade01 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage03 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage02 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage01 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Cannon-Damage01 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage02 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage01 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Cannon-Damage01 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Sys-Sensor-Upgrade01 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Struc-Research-Upgrade04 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Struc-Research-Upgrade03 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Struc-Research-Upgrade02 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Struc-Research-Upgrade01 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage03 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage02 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage01 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Cannon-Damage01 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage02 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage01 for R-Wpn-Howitzer-Incenediary
script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Cannon-Damage01 for R-Wpn-Howitzer-Incenediary
Code: Select all
Error occured on Saturday, February 16, 2013 at 23:23:28.
Program: G:\Games\Warzone 2100-master\warzone2100.exe(warzone2100)
Command line: "G:\Games\Warzone 2100-master\warzone2100.exe" "--debug=script"
Version: Version master 24dfe8f (modified locally) - Built Feb 16 2013
Distributor: buildbot
Compiled on: Feb 16 2013 05:54:57
Compiled by: GCC 4.7.0
Compiled mode: Release build
Executed on: Sat Feb 16 23:22:53 2013
Pointers: 32bit
Compiled against PhysicsFS version: 2.0.1
Running with PhysicsFS version: 2.0.1
Misc Data:
[23:22:54]Video Mode 1280 x 720 (window)
[23:22:54]OpenGL Vendor: NVIDIA Corporation
[23:22:54]OpenGL Renderer: GeForce GTX 560 Ti/PCIe/SSE2
[23:22:54]OpenGL Version: 4.3.0
[23:22:54]GLEW Version: 1.7.0
[23:22:54]OpenGL GLSL Version : 4.30 NVIDIA via Cg compiler
[23:22:54]OpenAL Device Name: DirectSound Default
[23:22:54]OpenAL Vendor: OpenAL Community
[23:22:54]OpenAL Version: 1.1 ALSOFT 1.13
[23:22:54]OpenAL Renderer: OpenAL Soft
[23:22:54]OpenAL Extensions: AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_LOKI_quadriphonic AL_SOFT_buffer_sub_data AL_SOFT_loop_points
[23:22:54]Using Backend: SDL
[23:22:54]Using language: System locale
[23:23:22]Current Level/map is Sk-Startup
G:\Games\Warzone 2100-master\warzone2100.exe caused an Access Violation at location 005012cd in module G:\Games\Warzone 2100-master\warzone2100.exe Reading from location 00000b73.
Log message: script |11:23:28: [js_findResearch:1203] Added research in 1's R-Struc-Research-Upgrade01 for R-Wpn-Howitzer-Incenediary
Log message: script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage03 for R-Wpn-Howitzer-Incenediary
Log message: script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage02 for R-Wpn-Howitzer-Incenediary
Log message: script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage01 for R-Wpn-Howitzer-Incenediary
Log message: script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Cannon-Damage01 for R-Wpn-Howitzer-Incenediary
Log message: script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage02 for R-Wpn-Howitzer-Incenediary
Log message: script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage01 for R-Wpn-Howitzer-Incenediary
Log message: script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Cannon-Damage01 for R-Wpn-Howitzer-Incenediary
Log message: script |11:23:28: [js_findResearch:1203] Added research in 1's R-Sys-Sensor-Upgrade01 for R-Wpn-Howitzer-Incenediary
Log message: script |11:23:28: [js_findResearch:1203] Added research in 1's R-Struc-Research-Upgrade04 for R-Wpn-Howitzer-Incenediary
Log message: script |11:23:28: [js_findResearch:1203] Added research in 1's R-Struc-Research-Upgrade03 for R-Wpn-Howitzer-Incenediary
Log message: script |11:23:28: [js_findResearch:1203] Added research in 1's R-Struc-Research-Upgrade02 for R-Wpn-Howitzer-Incenediary
Log message: script |11:23:28: [js_findResearch:1203] Added research in 1's R-Struc-Research-Upgrade01 for R-Wpn-Howitzer-Incenediary
Log message: script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage03 for R-Wpn-Howitzer-Incenediary
Log message: script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage02 for R-Wpn-Howitzer-Incenediary
Log message: script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage01 for R-Wpn-Howitzer-Incenediary
Log message: script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Cannon-Damage01 for R-Wpn-Howitzer-Incenediary
Log message: script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage02 for R-Wpn-Howitzer-Incenediary
Log message: script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Mortar-Damage01 for R-Wpn-Howitzer-Incenediary
Log message: script |11:23:28: [js_findResearch:1203] Added research in 1's R-Wpn-Cannon-Damage01 for R-Wpn-Howitzer-Incenediary
Registers:
eax=ffffffff ebx=0028ef38 ecx=0028ef38 edx=0000016e esi=10b304a8 edi=01fbb36c
eip=005012cd esp=0028ef10 ebp=0000000b iopl=0 nv up ei pl nz na pe nc
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010202
Call stack:
005012CD G:\Games\Warzone 2100-master\warzone2100.exe:005012CD convResearch /home/buildbot/slaves/warzone2100/master-nightly/build/src/researchdef.h:100
00DCA1D6 G:\Games\Warzone 2100-master\warzone2100.exe:00DCA1D6 SDL_SoftStretch
00517A63 G:\Games\Warzone 2100-master\warzone2100.exe:00517A63 js_findResearch /home/buildbot/slaves/warzone2100/master-nightly/build/src/qtscriptfuncs.cpp:1225
00E238EC G:\Games\Warzone 2100-master\warzone2100.exe:00E238EC SDL_SoftStretch
00E5FBBA G:\Games\Warzone 2100-master\warzone2100.exe:00E5FBBA SDL_SoftStretch
http://addons.wz2100.net/ developer
Re: Javascript API documentation
Thanks for the report. I've fixed it in most recent master (see 08567bebfbc061aaf62f3f151a3526e49fc88b3d).Duha wrote:troubles with findResearch
It is meant to return a list of requirements for a given tech. Please test if it works as expected now.
Re: Javascript API documentation
The Research object type currently has a .name property that gives an index/ID name rather than a full, human-readable name. I am considering changing this, putting the index/ID name into an .id property instead. Will this negatively impact anyone? If so, I will add both a .fullname and .id instead of changing .name for backwards compatibility for a few releases before making the switch.
Re: Javascript API documentation
I'm not using research info structures anywhere yet.
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
Re: Javascript API documentation
+1 for renaming it to .id (and similar things in other objects too pls) and using .name for the human readable name.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
Re: Javascript API documentation
Peeeeeeeeer. We need to support it.Cyp wrote:Add teams mode without shared research.
I mean, we already have alliancesType, and i guess it will be set to the new value now, and Cyp has even exported the new constant for us. But it's not very good: whenever the script was relying on alliancesType !== ALLIANCES_TEAMS it will break now (not sure such scripts exist though). Probably make a separate value, something like a boolean alliancesResearchShared?
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
Re: Javascript API documentation
P.S. Right now JS AIs don't research stuff researched by allies in no shared research mode (looks quite funny, one player has cannons on viper wheels and research module, other player has flamers on cobras halftracks)
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
Re: Javascript API documentation
Fixed.NoQ wrote:P.S. Right now JS AIs don't research stuff researched by allies in no shared research mode (looks quite funny, one player has cannons on viper wheels and research module, other player has flamers on cobras halftracks)
The new value for alliancesType is exported automatically. Rewriting the value before exporting it would be somewhat ugly. Are anyone adversely affected by this? (I think we are few enough who use the scripting AI still that we can deal with such compatibility breaks by asking that question on this forum.)
Re: Javascript API documentation
What will be affected is any rules.js mod, such as spectator mods or enchanced sitrep, in their victory/defeat conditions part.
I have heard of no other scripts that use alliancesType; NullBot or NullBotSW or NullBot3 do not use that yet.
I have heard of no other scripts that use alliancesType; NullBot or NullBotSW or NullBot3 do not use that yet.
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
Re: Javascript API documentation
rules.js uses alliancesType for victory conditions - so things like Enhanced SitRep Mod and Contingency Mod might be affected, but it should be trivial to make them adapt to the change. Speaking of which, what exactly is the change - been frantic IRL recently and not been keeping up with the qtscript changes...
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO