- Joined
- Nov 11, 2006
- Messages
- 7,650
and i meant what does ASCII stand for.
The American Standard Code for Information Interchange.
http://en.wikipedia.org/wiki/ASCII
and i meant what does ASCII stand for.
interface thisInterface {
}
interface thatInterface {
}
class MegaClass implements thisInterface, thatInterface {
}
interface thisInterface {
}
interface thatInterface {
}
class SuperMegaClass {
}
class MegaClass extends SuperMegaClass implements thisInterface, thatInterface {
}
interface panelA
endinterface
interface panelB
endinterface
struct parent
endstruct
struct child extends parent, panelA, panelB
endstruct
struct panelA
endstruct
struct panelB
endstruct
struct parent
endstruct
struct child extends parent
delegate panelA defaultA
delegate panelB defaultB
endstruct
struct ActionList
method runActions takes nothing returns nothing
endmethod
endstruct
struct CommandList
delegate ActionList del_a
static method create takes nothing returns thistype
local thistype a = allocate()
call a.runActions()
return a
endmethod
endstruct
CommandList
doesn't have the method runActions
? It will still work fine though since one of the struct's delegates has that method, so it will just use that.how do you set a variable equal to a preplaced object withought using the variable editor?
gg_unit_
. Then the type of the unit, and then the placement order in the World Editor. If you don't know what these values are, then just use a GUI trigger that allows you to select a pre-placed unit, then convert that trigger into custom text; there you will see the "name" of the preplaced unit.struct ActionList
real b = 1.0
method runActions takes nothing returns nothing
set b = b * 3
endmethod
method toValue takes nothing returns real
return b
endmethod
method toString takes nothing returns string
return R2S(b)
endmethod
endstruct
struct CommandList
delegate ActionList del_a
static method create takes nothing returns thistype
local thistype a = allocate()
set a.b = 2
call a.runActions()
call BJDebugMsg(R2S(a.toValue()))
return a
endmethod
endstruct
set a.b = 2
then 0.00 will be printed. It seems that delegates allow the use of struct members as well as methods, though the struct members are not initialized as they were in the delegate struct. As I have it not 6.00 will be displayed.struct ActionList
real b = 1.0
method runActions takes nothing returns nothing
set b = b * 3
endmethod
method toValue takes nothing returns real
return b
endmethod
method toString takes nothing returns string
return R2S(b)
endmethod
endstruct
struct CommandList
delegate ActionList del_a
static method create takes nothing returns thistype
local thistype a = allocate()
set a.del_a = ActionList.create()
//set a.b = 2
call a.runActions()
call BJDebugMsg(R2S(a.toValue()))
return a
endmethod
endstruct
set a.b = 2
is not necessary, as b
will be initialized to 1.0
in the constructor of ActionList
.struct exampleA
real r = 2
method add takes nothing returns nothing
set r=r+r
endmethod
endstruct
struct exampleB
delegate exampleA a
method add takes nothing returns nothing
set r = r + r + r
endmethod
static method create takes nothing returns thistype
local thistype m = allocate()
set m.a = exampleA.create()
call m.add()
call BJDebugMsg(R2S(m.r))
return m
endmethod
static method onInit takes nothing returns nothing
call thistype.create()
endmethod
endstruct
set r = r + r + r
(r starts at 2) using a delegate's member. If you remove the method add
from the delegating struct, then it will print out 4.00 because it will perform set r = r + r
(r starts at 2).delegate
keyword just allows an automatic association of actions with the delegate object. If you were to not include the delegate keyword, and simply declare exampleA a
then you would manually have to use a.add()
. Since you're using a delegate, you can consider the add method apart of the delegating struct's interface.globals
integer array pindex//player index
integer array lindex//to reference the owner of the instance of the struct: P
integer MP = 0//max players
boolean MIS = false
boolean WG = false
boolean AB = false
boolean AV = false
boolean ES = false
boolean SA = false
string array CS
string CE = "c|"
region array BG
rect array BGR
rect array ARSDB
rect array ARSDBE
rect array AHB
rect array HRSDB
rect array HRSDBE
rect array HHB
rect DZ
real DZX
real DZY
rect HTR
rect HCS
rect FDZ
group AH = CreateGroup()
group HH = CreateGroup()
group ASDB = CreateGroup()
group HSDB = CreateGroup()
item array M
integer array MID
stats array s
endglobals
struct stats
private integer id
static multiboard mb = CreateMultiboard()
integer array fpu[3]//wg,es,total
integer array fd[3]//wg,es,total
integer array fc[3]//wg,es,total
integer array ba[3]//ab,es,total
integer array bd[3]//ab,es,total
integer array bc[3]//ab,es,total
integer array sd[3]//avtd,sagd,total
integer array w[6]//wins
integer array l[6]//losses
integer array os[4]//wgfr,vu,vd,vl
integer array bs[2]//k,d
real kdr
multiboarditem array mfpy[3]
multiboarditem array mfd[3]
multiboarditem array mfc[3]
multiboarditem array mba[3]
multiboarditem array mbd[3]
multiboarditem array mbc[3]
multiboarditem array msd[3]
multiboarditem array mw[6]
multiboarditem array ml[6]
multiboarditem array mos[4]
multiboarditem array mbs[3]
method operator b= takes integer i returns nothing
set.bs[i] = .bs[i] + 1
set .kdr = I2R(.bs[0]/.bs[1])
call MultiboardSetItemValue(.mbs[i], I2S(.bs[i]))
call MultiboardReleaseItem(.mbs[i])
set .mbs[i] = MultiboardGetItem(thistype.mb, 4 + .id, 3 + i)
call MultiboardSetItemValue(.mbs[2], R2S(.kdr))
call MultiboardReleaseItem(.mbs[2])
set .mbs[2] = MultiboardGetItem(thistype.mb, 4 + .id, 6)
endmethod
method operator o= takes integer i returns nothing
set.os[i] = .os[i] + 1
call MultiboardSetItemValue(.mos[i], I2S(.os[i]))
call MultiboardReleaseItem(.mos[i])
if i == 1 then
set .mos[i] = MultiboardGetItem(thistype.mb, 4 + .id, 25)
else
set .mos[i] = MultiboardGetItem(thistype.mb, 4 + .id, 37 + i)
endif
endmethod
static method create takes integer id, boolean inA returns thistype
local thistype p = thistype.allocate()
local multiboarditem array mbi
local string n = GetPlayerName(Player(id))
local playercolor c = GetPlayerColor(Player(id))
local string cs
local integer i = 1
set p.id = id
if id == 0 then
set cs = "Red"
elseif id == 1 then
set cs = "Blue"
elseif id == 2 then
set cs = "Teal"
elseif id == 3 then
set cs = "Purple"
elseif id == 4 then
set cs = "Yellow"
elseif id == 5 then
set cs = "Orange"
elseif id == 6 then
set cs = "Green"
elseif id == 7 then
set cs = "Pink"
elseif id == 8 then
set cs = "Gray"
elseif id == 9 then
set cs = "Light Blue"
elseif id == 10 then
set cs = "Dark Green"
elseif id == 11 then
set cs = "Brown"
endif
set id = id + 1
loop
exitwhen i == 3
set mbi[i] = MultiboardGetItem(thistype.mb, 3 + id, i)
endloop
if (inA) then
set n = CS[1]+n+CE
else
set n = CS[2]+n+CE
endif
call MultiboardSetItemValue(mbi[1], n)
call MultiboardSetItemValue(mbi[2], I2S(id))
call MultiboardSetItemValue(mbi[3], cs)
return p
endmethod
endstruct
function InitTrig_teststart takes nothing returns nothing
local integer i = 0
set CS[1] = "|cffff0000"//red
set CS[2] = "|cff0000ff"//blue
set CS[3] = "|cffc60000"//dark red
set CS[4] = "|cffffff00"//topaz
set CS[5] = "|cffff8800"//citrine
set CS[6] = "|cff00dc00"//emerald
set CS[7] = "|cff5000bb"//amethyst
set CS[8] = "|cff000000"//black (onyx)
set CS[9] = "|cffffffff"//white (opal)
loop
exitwhen i == 11
if i < 6 then
set s[i] = stats.create(i, true)
else
set s[i] = stats.create(i, false)
endif
endloop
call MultiboardSetColumnCount(stats.mb, 45)
call MultiboardSetRowCount(stats.mb, 15)
call MultiboardSetItemsStyle(stats.mb, true, false)
call MultiboardDisplay(stats.mb, true)
endfunction
function Trig_unit_death_Actions takes nothing returns nothing
local unit d = GetDyingUnit()
local unit k = GetKillingUnit()
local integer did = GetPlayerId(GetOwningPlayer(d))
local integer kid = GetPlayerId(GetOwningPlayer(k))
set s[did].b= 1
set s[kid].b=0
endfunction
//===========================================================================
function InitTrig_unit_death takes nothing returns nothing
set gg_trg_unit_death = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_unit_death, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_unit_death, function Trig_unit_death_Actions )
endfunction
set mb = CreateMultiboard()
.Berbanog said:If the delegate is not initialized (created) then the usefulness of it plummets. If it is initialized (I don't know why it's not initialized automatically) then it works in the exact same way as an interface would.
I have no idea what you are referring to by "killable" / "targetable". Sorry.