Ho il cervellunzo in pappa! non mi ricordo piu come si compilano gli xml!!!
Stavo facendo un piccolo codice(un cheat a dire il vero, per il momento) per la produzione di missili in serie!
Vi posto i codici cosi mi potete suggerire!
setup.missile.generator (questo funziona)
Code: Select all
$PAGEID = 7550
set global variable: name='mg.page' value=$PAGEID
load text: id=$PAGEID
$zz = '4.07'
set global variable: name='mg.version' value=$zz
$anull = null
START $anull-> call script 'missile.generator.init' :
return null
Code: Select all
$previous.version = get global variable: name='missile.generator.Version'
$actual.version = get script version
if $previous.version == null
load text: id=7550
add ship custom command: id=1242
set ship command preload script: command=[COMMAND_TYPE_SHIP_41] script='missile.generator.preload'
set script command upgrade: command=[COMMAND_TYPE_SHIP_41] upgrade={Special Command Software MK1}
global script map: set: key=[COMMAND_TYPE_SHIP_41], class=[Big Ship], race=[Player], script='missile.generator', prio=0
set global variable: name='missile.generator.Version' value=$actual.version
= wait 1000 ms
$message = read text: page=7550 id=1
send incoming message $message to player: display it=[TRUE]
else if $actual.version > $previous.version
load text: id=7550
remove ship custom command: id=1242
add ship custom command: id=1242
set ship command preload script: command=[COMMAND_TYPE_SHIP_41] script='missile.generator.main'
set script command upgrade: command=[COMMAND_TYPE_SHIP_41] upgrade={Special Command Software MK1}
global script map: set: key=[COMMAND_TYPE_SHIP_41], class=[Big Ship], race=[Player], script='missile.generator', prio=0
set global variable: name='missile.generator.Version' value=$actual.version
= wait 1000 ms
$message = read text: page=7550 id=2
send incoming message $message to player: display it=[TRUE]
else
add ship custom command: id=1242
set ship command preload script: command=[COMMAND_TYPE_SHIP_41] script='missile.generator.main'
set script command upgrade: command=[COMMAND_TYPE_SHIP_41] upgrade={Special Command Software MK1}
global script map: set: key=[COMMAND_TYPE_SHIP_41], class=[Big Ship], race=[Player], script='missile.generator', prio=0
end
return null
Code: Select all
$AL.STATE.VERSION = 0
$AL.STATE.ENABLED = 1
$al.State = get global variable: name=$al.PluginID
if not $al.State
$al.State = array alloc: size=7
$Version = get script version
$al.State[$AL.STATE.VERSION] = $Version
$al.State[$AL.STATE.ENABLED] = [TRUE]
set global variable: name=$al.PluginID value=$al.State
end
$al.Retval = null
if $al.Event == 'init' OR $al.Event == 'reinit'
$Page.ID = get global variable: name='plugin.missile.generator.id'
$al.PluginDesc = sprintf: pageid=$Page.ID textid=1, null, null, null, null, null
al engine: set plugin $al.PluginID description to $al.PluginDesc
al engine: set plugin $al.PluginID timer interval to 300 s
else if $al.Event == 'start'
$al.State[$AL.STATE.ENABLED] = [TRUE]
else if $al.Event == 'stop'
$al.State[$AL.STATE.ENABLED] = [FALSE]
else if $al.Event == 'isenabled'
$al.Retval = $al.State[$AL.STATE.ENABLED]
else if $al.Event == 'timer'
= [THIS]-> call script 'missile.generator.timer' : argument1=$al.PluginID argument2=$al.State
end
return $al.Retval
Code: Select all
skip if $al.state[1]
return null
$ships = get ship array: of race [Player] class/type=[Moveable Ship]
for each $s in array $ships using counter $count
skip if $s-> get amount of ware {Special Command Software MK1} in cargo bay
continue
$ammo = $s-> get amount of ware {Tomahawk Heavy Missile} in cargo bay
skip if $ammo < 50
continue
= $s-> add 2 units of {Tomahawk Heavy Missile}
end
return null