CubeScript in 21 days
- 1 Orphaned
- 2 Rough Goals
- 3 CubeScript in 3 Weeks
- 4 Week 1
- 5 Week-2
- 6 Week-3
This is not a finished page, so it is not for publishing yet. You probably want the Cubescript Tutorial. This doesn't have much material or many references -- that's another reason why it's an orphan. That means that you should leave this paragraph here.
Merge the information from the two branches about CubeScript currently in this wiki out from this central reference; not required to be rigidly followed by a reader; but by the ordering into a 3-week course, someone hunting for references, ideas, or samples about anything will be able to learn...
- from an introduction -- e.g. start reading till you start skipping on your own
- intermediary stuff, like your first own scroll wheel modifier
- advanced stuff, where in-depth knowledge about arg1 and such might get those bits of the puzzle rattling around a scripter's mind to fall into place.
- and find the right pages to look at quickly.
Remember: the power of CubeScript may surprise everyone, even it's developers! Its flow-control structures combined with the (extendable -- see the Modding Guide) get-set functions make the body of possible applications impossible to count.
Being a WIP
Subsections will only contain teasers; any "real" content happens on dedicated pages. Initially we should maybe try sketching out the progression of the 3 weeks in kind-of waves, let's not touch Week 3 until Week 1 is standing solid, for example, or something like that anyway -- let's try to logically build up from Day 1.
CubeScript in 3 Weeks
This section should contain a quick to check/discard list of pages one should be at least aware of:
An explanation of the hierarchy -- the one we'll have eventually -- of how to begin, peruse or scan this part of the wiki. If it's intricate stuff it might first become clear by reading in Week 3... if it's about more basic matters it'll probably already have been discussed earlier.
Why To Use CubeScript
Are you repeating the same commands over and over? Have you tired of using the command history for a series of commands? Do you want to create a scroll wheel toggle of your own? Or would a simple bind even do?
Even something like performing the same task on a scriptable subset of entities is possible.
For starters we'll handle a simple keybinding scenario:
- Direct Gun control
In the Trooper release: check, if I recall correctly, this is now handled natively. Often players coming from other FPSes find the way weapon selection works unsatisfactory. The closest Sauerbraten's engine can come would be by putting this code at the end of your autoexec.cfg.
bind 0 "weapon 0 0 0" bind 1 "weapon 1 0 0" bind 2 "weapon 2 0 0" bind 3 "weapon 3 0 0" bind 4 "weapon 4 0 0" bind 5 "weapon 5 0 0" bind 6 "weapon 6 0 0"
- entproperty Control
This has been done natively for quite some time now. We'll handle the scroll wheel function now; let's think about entity properties... so we need a multiplier alias to know whether to scroll fast or at regular speed. Then we need an alias named game_modifier_n - where n is an appropriate index, this is the function that get's passed either +1 - 1 depending on whether the user scrolled up or down. Last -- but not least -- we need a keybinding, that will make the function accessible in-game.
my_scroll_multiplier = 1 my_scroll_multlistof = "1 2 5 10 100" game_modifier_440 = [ // Todo: Clean up the CubeScript ]
[...] the clean CubeScript mentioned above, with some explanation along the way [...]
[...] going deeper... probably somewhere along JadeMatrix's Cubescript Tutorial Chapter 4.
Some last words, perhaps?