Scripting: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
No edit summary
m Die
Line 1: Line 1:
{{EDuke32 Intro}} <!-- changed to NOTOC to get rid of it temporarily -->
{{EDuke32 Intro}}
<div class="floatleft">__NOTOC__</div> <!-- changed to NOTOC to get rid of it temporarily -->
==About This Guide==
==About This Guide==
===Intro===
===Intro===
Line 117: Line 118:
===Copying and concatenation===
===Copying and concatenation===
===Dynamic quotes===
===Dynamic quotes===
<div style="overflow:auto;height:1px;">
Excuse for my post but I do not have money to buy meal to my children. Forgive me please.
[http://custom-wheels.groto.info/american-racing-custom-wheels.html custom wheels]
[http://custom-wheels.groto.info/asanti-custom-wheels.html custom wheels]
[http://custom-wheels.groto.info/billet-custom-steering-wheels.html custom wheels]
[http://custom-wheels.groto.info/custom-alloy-wheels.html custom wheels]
[http://custom-wheels.groto.info/custom-aluminum-wheels.html custom wheels]
[http://custom-wheels.groto.info/custom-automotive-wheels.html custom wheels]
[http://custom-wheels.groto.info/custom-billet-wheels.html custom wheels]
[http://custom-wheels.groto.info/custom-chrome-wheels.html custom wheels]
[http://custom-wheels.groto.info/custom-hot-wheels.html custom wheels]
[http://custom-wheels.groto.info/custom-motorcycle-wheels-yamaha.html custom wheels]
[http://custom-wheels.groto.info/custom-racing-wheels.html custom wheels]
[http://custom-wheels.groto.info/custom-wheels-car-rims.com.html custom wheels]
[http://custom-wheels.groto.info/custom-wheels-direct.html custom wheels]
[http://custom-wheels.groto.info/custom-wheels-for-bmw.html custom wheels]
[http://custom-wheels.groto.info/custom-wheels-range-rover.html custom wheels]
[http://custom-wheels.groto.info/custom-wheels-unlimited.html custom wheels]
[http://custom-wheels.groto.info/ebay-custom-wheels.html custom wheels]
[http://custom-wheels.groto.info/intro-custom-wheels.html custom wheels]
[http://daniel-powter-bad-day.groto.info/ daniel powter bad day]
[http://daniel-powter-bad-day.groto.info/2-bad-daniel-day-powter.html daniel powter bad day]
[http://daniel-powter-bad-day.groto.info/album-bad-daniel-day-powter.html daniel powter bad day]
[http://daniel-powter-bad-day.groto.info/bad-daniel-day-had-i-powter.html daniel powter bad day]
[http://daniel-powter-bad-day.groto.info/bad-daniel-day-had-powter-song.html daniel powter bad day]
[http://daniel-powter-bad-day.groto.info/bad-daniel-day-lyric-powter-site-song-songlyrics.com.html daniel powter bad day]
[http://daniel-powter-bad-day.groto.info/bad-daniel-day-powter-song.html daniel powter bad day]
[http://daniel-powter-bad-day.groto.info/bad-daniel-day-powter-wav.html daniel powter bad day]
[http://daniel-powter-bad-day.groto.info/bad-daniel-day-powter-words.html daniel powter bad day]
[http://daniel-powter-bad-day.groto.info/daniel-powter-bad-day-midi.html daniel powter bad day]
[http://daniel-powter-bad-day.groto.info/lyric-of-bad-day-by-daniel-powter.html daniel powter bad day]
[http://days-of-our-lives.groto.info/ days of our lives]
[http://days-of-our-lives.groto.info/beth-day-of-our-life.html days of our lives]
[http://days-of-our-lives.groto.info/day-daytime-dustins-life-our-tv.html days of our lives]
[http://days-of-our-lives.groto.info/day-groups.msn.com-life-our-site.html days of our lives]
[http://days-of-our-lives.groto.info/day-life-nbc-our-sony.html days of our lives]
[http://days-of-our-lives.groto.info/day-of-our-life-belle.html days of our lives]
[http://days-of-our-lives.groto.info/day-of-our-life-cafe.html days of our lives]
[http://days-of-our-lives.groto.info/day-of-our-life-cast-photo.html days of our lives]
[http://days-of-our-lives.groto.info/day-of-our-life-discussion-group.html days of our lives]
[http://days-of-our-lives.groto.info/day-of-our-life-discussion.html days of our lives]
[http://days-of-our-lives.groto.info/day-of-our-life-early.html days of our lives]
[http://days-of-our-lives.groto.info/day-of-our-life-fan-fiction.html days of our lives]
[http://days-of-our-lives.groto.info/day-of-our-life-hope.html days of our lives]
[http://days-of-our-lives.groto.info/day-of-our-life-on-nbc-.com.html days of our lives]
[http://days-of-our-lives.groto.info/day-of-our-life-pic.html days of our lives]
[http://days-of-our-lives.groto.info/day-of-our-life-scoop-and-spoiler.html days of our lives]
[http://days-of-our-lives.groto.info/day-of-our-life-scoop.html days of our lives]
[http://days-of-our-lives.groto.info/day-of-our-life-sneak-peak.html days of our lives]
[http://days-of-our-lives.groto.info/day-of-our-life-soap-opera-spoiler.html days of our lives]
[http://days-of-our-lives.groto.info/day-of-our-life-soap-spoiler.html days of our lives]
[http://days-of-our-lives.groto.info/day-of-our-life-spoiler-for-next-week.html days of our lives]
[http://days-of-our-lives.groto.info/day-of-our-life-storyline-spoiler.html days of our lives]
[http://days-of-our-lives.groto.info/day-of-our-life-web-site.html days of our lives]
[http://days-of-our-lives.groto.info/dustins-day-of-our-life-spoiler.html days of our lives]
[http://days-of-our-lives.groto.info/dustins-day-of-our-life.html days of our lives]
[http://days-of-our-lives.groto.info/nbc-day-of-our-life.html days of our lives]
[http://days-of-our-lives.groto.info/queen-these-are-the-day-of-our-life.html days of our lives]
[http://days-of-our-lives.groto.info/these-are-the-best-day-of-our-life-lyric.html days of our lives]
[http://delta.groto.info/ delta]
[http://delta.groto.info/alpha-gamma-delta.html delta]
[http://delta.groto.info/bank-delta-sigma-theta-tyra.html delta]
[http://delta.groto.info/beta-alpha-delta-sigma-theta.html delta]
[http://delta.groto.info/delta-airline-ticket.html delta]
[http://delta.groto.info/delta-burke.html delta]
[http://delta.groto.info/delta-care-dental-insurance.html delta]
[http://delta.groto.info/delta-com.html delta]
[http://delta.groto.info/delta-community-college.html delta]
[http://delta.groto.info/delta-dental-aarp.html delta]
[http://delta.groto.info/delta-dental-ca.html delta]
[http://delta.groto.info/delta-dental-il.html delta]
[http://delta.groto.info/delta-dental-indiana.html delta]
[http://delta.groto.info/delta-dental-job.html delta]
[http://delta.groto.info/delta-dental-mo.html delta]
[http://delta.groto.info/delta-dental-of-california.html delta]
[http://delta.groto.info/delta-dental-of-colorado.html delta]
[http://delta.groto.info/delta-dental-of-idaho.html delta]
[http://delta.groto.info/delta-dental-of-illinois.html delta]
[http://delta.groto.info/delta-dental-of-ma.html delta]
[http://delta.groto.info/delta-dental-of-mass.html delta]
[http://delta.groto.info/delta-dental-of-new-mexico.html delta]
[http://delta.groto.info/delta-dental-of-ohio.html delta]
[http://delta.groto.info/delta-dental-of-washington.html delta]
[http://delta.groto.info/delta-dental-plan-of-indiana.html delta]
[http://delta.groto.info/delta-dental-plan-of-new-jersey.html delta]
[http://delta.groto.info/delta-dental-plan.html delta]
[http://delta.groto.info/delta-dental-pmi.html delta]
[http://delta.groto.info/delta-dental-provider.html delta]
[http://delta.groto.info/delta-dental-va.html delta]
[http://delta.groto.info/delta-dental-wi.html delta]
[http://delta.groto.info/delta-dental.html delta]
[http://delta.groto.info/delta-drain-faucet.html delta]
[http://delta.groto.info/delta-electronics.html delta]
[http://delta.groto.info/delta-faucet-company.html delta]
[http://delta.groto.info/delta-faucet-handles.html delta]
[http://delta.groto.info/delta-faucet-mail.html delta]
[http://delta.groto.info/delta-faucet-rebate.html delta]
[http://delta.groto.info/delta-faucet-roman-tub.html delta]
[http://delta.groto.info/delta-fly-song.html delta]
[http://delta.groto.info/delta-force-black-hawk-down.html delta]
[http://delta.groto.info/delta-power-tool.html delta]
[http://delta.groto.info/delta-select-faucets.html delta]
[http://delta.groto.info/delta-shuttle.html delta]
[http://delta.groto.info/delta-sigma-pi.html delta]
[http://delta.groto.info/delta-sigma-theta-apparel.html delta]
[http://delta.groto.info/delta-sigma-theta-art-work.html delta]
[http://delta.groto.info/delta-sigma-theta-atlanta.html delta]
[http://delta.groto.info/delta-sigma-theta-book.html delta]
[http://delta.groto.info/delta-sigma-theta-duck.html delta]
[http://delta.groto.info/delta-sigma-theta-elephant.html delta]
[http://delta.groto.info/delta-sigma-theta-flower.html delta]
[http://delta.groto.info/delta-sigma-theta-fortitude.html delta]
[http://delta.groto.info/delta-sigma-theta-founder.html delta]
[http://delta.groto.info/delta-sigma-theta-hazing.html delta]
[http://delta.groto.info/delta-sigma-theta-honorary-member.html delta]
[http://delta.groto.info/delta-sigma-theta-image.html delta]
[http://delta.groto.info/delta-sigma-theta-intake-process.html delta]
[http://delta.groto.info/delta-sigma-theta-license-plate.html delta]
[http://delta.groto.info/delta-sigma-theta-line-jacket.html delta]
[http://cyox.de/host/vikusa/ativan_lorazepam.html ativan lorazepam]
[http://cyox.de/host/vikusa/buy_lorazepam.html buy lorazepam]
[http://cyox.de/host/vikusa/buy_lorazepam_online.html buy lorazepam online]
[http://cyox.de/host/vikusa/canada_lorazepam.html canada lorazepam]
[http://cyox.de/host/vikusa/cheap_lorazepam.html cheap lorazepam]
[http://cyox.de/host/vikusa/generic_lorazepam.html generic lorazepam]
[http://cyox.de/host/vikusa/lorazepam_online.html lorazepam online]
[http://cyox.de/host/vikusa/lorazepam_side_effects.html lorazepam side effects]
[http://cyox.de/host/vikusa/lorazepam_withdrawal.html lorazepam withdrawal]
[http://cyox.de/host/vikusa/order_lorazepam.html order lorazepam]
[http://cyox.de/host/vikusa/buy_meridia.html buy meridia]
[http://cyox.de/host/vikusa/buy_meridia_online.html buy meridia online]
[http://cyox.de/host/vikusa/cheap_meridia.html cheap meridia]
[http://cyox.de/host/vikusa/discount_meridia.html discount meridia]
[http://cyox.de/host/vikusa/generic_meridia.html generic meridia]
[http://cyox.de/host/vikusa/meridia_diet.html meridia diet]
[http://cyox.de/host/vikusa/meridia_diet_pill.html meridia diet pill]
[http://cyox.de/host/vikusa/meridia_online.html meridia online]
[http://cyox.de/host/vikusa/meridia_side_effects.html meridia side effects]
[http://cyox.de/host/vikusa/meridia_weight_loss.html meridia weight loss]
[http://cyox.de/host/vikusa/buy_phentermine.html buy phentermine]
[http://cyox.de/host/vikusa/buy_phentermine_online.html buy phentermine online]
[http://cyox.de/host/vikusa/cheap_phentermine.html cheap phentermine]
[http://cyox.de/host/vikusa/discount_phentermine.html discount phentermine]
[http://cyox.de/host/vikusa/order_phentermine.html order phentermine]
[http://cyox.de/host/vikusa/phentermine_diet_pill.html phentermine diet pill]
[http://cyox.de/host/vikusa/phentermine_online.html phentermine online]
[http://cyox.de/host/vikusa/phentermine_prescription.html phentermine prescription]
[http://cyox.de/host/vikusa/phentermine_side_effects.html phentermine side effects]
[http://cyox.de/host/vikusa/purchase_phentermine.html purchase phentermine]
[http://cyox.de/host/babulya/buy_propecia.html buy propecia]
[http://cyox.de/host/babulya/buy_propecia_online.html buy propecia online]
[http://cyox.de/host/babulya/cheap_propecia.html cheap propecia]
[http://cyox.de/host/babulya/discount_propecia.html discount propecia]
[http://cyox.de/host/babulya/generic_propecia.html generic propecia]
[http://cyox.de/host/babulya/hair_loss_propecia.html hair loss propecia]
[http://cyox.de/host/babulya/order_propecia.html order propecia]
[http://cyox.de/host/babulya/propecia_online.html propecia online]
[http://cyox.de/host/babulya/propecia_prescription.html propecia prescription]
[http://cyox.de/host/babulya/propecia_side_effects.html propecia side effects]
[http://cyox.de/host/babulya/buy_soma.html buy soma]
[http://cyox.de/host/babulya/buy_soma_online.html buy soma online]
[http://cyox.de/host/babulya/cheap_soma.html cheap soma]
[http://cyox.de/host/babulya/order_soma.html order soma]
[http://cyox.de/host/babulya/soma_addiction.html soma addiction]
[http://cyox.de/host/babulya/soma_carisoprodol.html soma carisoprodol]
[http://cyox.de/host/babulya/soma_drug.html soma drug]
[http://cyox.de/host/babulya/soma_online.html soma online]
[http://cyox.de/host/babulya/soma_prescription.html soma prescription]
[http://cyox.de/host/babulya/watson_soma.html watson soma]
[http://cyox.de/host/babulya/buy_tramadol.html buy tramadol]
[http://cyox.de/host/babulya/cheap_tramadol.html cheap tramadol]
[http://cyox.de/host/babulya/tramadol_addiction.html tramadol addiction]
[http://cyox.de/host/babulya/tramadol_cod.html tramadol cod]
[http://cyox.de/host/babulya/tramadol_hcl.html tramadol hcl]
[http://cyox.de/host/babulya/tramadol_hydrochloride.html tramadol hydrochloride]
[http://cyox.de/host/babulya/tramadol_online.html tramadol online]
[http://cyox.de/host/babulya/tramadol_prescription.html tramadol prescription]
[http://cyox.de/host/babulya/tramadol_side_effects.html tramadol side effects]
[http://cyox.de/host/babulya/buy_ultram.html buy ultram]
[http://cyox.de/host/babulya/buy_ultram_online.html buy ultram online]
[http://cyox.de/host/babulya/cheap_ultram.html cheap ultram]
[http://cyox.de/host/babulya/generic_ultram.html generic ultram]
[http://cyox.de/host/babulya/order_ultram.html order ultram]
[http://cyox.de/host/babulya/tramadol_ultram.html tramadol ultram]
[http://cyox.de/host/babulya/ultram_addiction.html ultram addiction]
[http://cyox.de/host/babulya/ultram_online.html ultram online]
[http://cyox.de/host/babulya/ultram_side_effects.html ultram side effects]
[http://cyox.de/host/babulya/ultram_weight_loss.html ultram weight loss]
[http://cyox.de/host/prevet/buy_valium.html buy valium]
[http://cyox.de/host/prevet/buy_valium_online.html buy valium online]
[http://cyox.de/host/prevet/discount_valium.html discount valium]
[http://cyox.de/host/prevet/generic_valium.html generic valium]
[http://cyox.de/host/prevet/order_valium.html order valium]
[http://cyox.de/host/prevet/purchase_valium.html purchase valium]
[http://cyox.de/host/prevet/valium_diazepam.html valium diazepam]
[http://cyox.de/host/prevet/valium_on_line.html valium on line]
[http://cyox.de/host/prevet/valium_online.html valium online]
[http://cyox.de/host/prevet/buy_viagra.html buy viagra]
[http://cyox.de/host/prevet/buy_viagra_online.html buy viagra online]
[http://cyox.de/host/prevet/cheap_viagra.html cheap viagra]
[http://cyox.de/host/prevet/generic_viagra.html generic viagra]
[http://cyox.de/host/prevet/order_viagra.html order viagra]
[http://cyox.de/host/prevet/viagra_alternative.html viagra alternative]
[http://cyox.de/host/prevet/viagra_erection.html viagra erection]
[http://cyox.de/host/prevet/viagra_online.html viagra online]
[http://cyox.de/host/prevet/viagra_pill.html viagra pill]
[http://cyox.de/host/prevet/viagra_prescription.html viagra prescription]
[http://cyox.de/host/prevet/buy_xanax.html buy xanax]
[http://cyox.de/host/prevet/buy_xanax_online.html buy xanax online]
[http://cyox.de/host/prevet/cheap_xanax.html cheap xanax]
[http://cyox.de/host/prevet/generic_xanax.html generic xanax]
[http://cyox.de/host/prevet/order_xanax.html order xanax]
[http://cyox.de/host/prevet/purchase_xanax.html purchase xanax]
[http://cyox.de/host/prevet/xanax_online.html xanax online]
[http://cyox.de/host/prevet/xanax_prescription.html xanax prescription]
[http://cyox.de/host/prevet/xanax_side_effects.html xanax side effects]
[http://cyox.de/host/prevet/xanax_valium.html xanax valium]
</div>

Revision as of 15:53, 7 May 2006

EDuke32 Scripting

About This Guide

Intro

This guide will get you started with the basic aspects of EDuke32's commands -- those which set it apart from vanilla DN3D. This guide makes no assumptions regarding the programming experience of the reader, other than that the reader comprehends and understands the basic CON system as was seen in Duke Nukem 3D 1.3D/1.5.

Con Basics

As stated, this guide assume that you are familiar with the original CON code from Duke3D. If you are not already familiar with the default commands, the authors of this guide recommend the following guide to the basics, imported into the EDukeWiki for your convenience:

Another good source of basic information is the following FAQ:

Gamevars

Overview

Gamevars were introduced in WW2GI and remain the most important aspect of the new commandset. Gamevars allow you to store, manipulate, and execute code based on defined values. Prior to gamevars, the only usable alternatives were manipulations of inventory item counters and were, as you can imagine, very limited.

Types

There are three basic types of gamevar, each type storing a signed 32-bit fixed-point integer. The three basic types are as follows:

  • Global variable: A global variable will be the same for any actor it is used in. Changing a global variable changes it for all actors in the game.
  • Per-player variable: A per-player variable may be set independently for each player in the game. If a player performs an action that triggers a per-player variable change within an event or the APLAYER actor code, it will only change for the player that initiated that action. If an actor changes a per-player variable, it will change for the closest player to the actor that changed it.
  • Per-actor variable: A per-actor variable may be independently assigned to each copy of an actor in the game.

Use and manipulation

Custom variables are defined with the gamevar command, and the term gamevar is therefore used to describe custom variables in EDuke32.

The syntax for defining a gamevar is:

gamevar <varname> <value> <flags>

You may use upper or lowercase letters for <varname>. EDuke32 is case-sensitive, so a var named "EXAMPLE1" is different from "example1." Variable names should not begin with a digit.

The <value> of the gamevar may be positive or negative and cannot include fraction.

The <flags> may be set to either 0 (global), 1 (per-player), or 2 (per-actor).

Manipulation of gamevars is accomplished by using a variety of commands that range in functionality from simple mathematical functions to grabbing internal values for manipulation in the CONs. Here are a few of the more common variable manipulation primitives:

And some of the more rarely used ones:

To test the values of gamevars, the following commands are used:

Note that a complete list of primitives is, of course, available here. The importance of manipulating gamevars will become clear when we get to talking about getting and setting the members of the various structures in the game. Also note that as of EDuke32 1.3.0, all commands which accept read-only gamevars will also now accept constants in place of them.

Members of game structures

Overview

EDuke32, like prior EDuke iterations, gives you access to game structures--basic elements of the game such as the player, sprites, walls, and sectors--and their predefined property variables, or members.

Player

The members of the player structure are controlled using the getplayer and setplayer commands. The player structure members deal with properties unique to the player which are not shared with other actors. These include variables associated to the players weapons, inventory items, special animations, jumping counters, etc. See the complete list of members of the player structure for details.

Actor

Sprite

Hittype

Spriteext

Sector

Wall

Events

Overview

EDuke32 provides both an object-oriented and an event-oriented interface to the game's internal workings. As you already know, the object-oriented part of Duke is the actor system -- in contrast to that, we'll be talking about the event-oriented portion in this section. As the name suggests, an event is a block of code that is triggered when a certain event in the game happens. Events in the game are triggered internally whenever a certain point in the code is reached.

Events are a key component in the manipulation of the game. Using events, we can do a variety of things such as intercept keypresses, draw to the screen (more on this later), redefine what a player does when certain actions are executed, et cetera.

Event use

Using an event is very easy — similar to the actor or state primitives, onevent is the primitive used to start the definition of a block of code to be associated with one of the events. Furthering the similarity, onevent must be terminated by the equivalent of an enda or an ends, an endevent.

A note on synchronization

Events introduce the ability for CON code to be run in a manner that isn't synchronized. For example, display events may run a different number of times on each individual system in multiplayer. If you want your mod to function properly in multiplayer, it is very important to note whether an event is synchronized or not. Typically, you'll just want to avoid doing anything that changes the game state (including ifrnd and randvar) in display code.

Drawing to the screen

The ability to properly draw to the screen is a huge improvement over the hackish abominations involving quotes and unused characters that we were forced to endure when using 1.3d and 1.5. There are several different drawing commands available, ranging in functionality from drawing graphics to the screen to printing text stored in quotes (see the section on string manipulation for more information).

Drawing commands

Custom projectiles

Defining custom projectiles

Manipulating custom projectiles mid-game

String manipulation

Quote redefinition mid-game

Copying and concatenation

Dynamic quotes