Nexus Modding > Scripting

Scripting Issues

<< < (9/25) > >>

The Old Dragon:
Thanks guys, I thought it was along those lines, just didn't know how to factor in the speed condition.

Mularac:
Is is there a way to mimic a "for" command in the BlackRuler scriptim system? I desperately need one for the piece of coding I'm working on.
here's the original idea, it's rather simple... and easy, if I could just use a bloody for...:
I need to collect each weapon in a separete variable, like this, for instance: e.norm_weap1, e.heavy_weap3 and such. I'm dealing with both an unknown ammount of weapons (from 0 to 7) and an unknown type of devicetype for each set. My only information is that the ships carries 2 slots for normal weapons, 2 for heavy, 2 specials and one for artillery (for now it's just an other heavy, but I'll find the way to set it apart). Don't mind the flaks.

Arparso:
Nexus doesn't know a for-loop, but it knows while-loops and both are pretty much interchangeable. For example:


--- Code: ---for (int i = 0; i < 10; i++)
{
Console.WriteLine("Index is {0}", i);
}

--- End code ---

... might be written in Nexus scripting as:


--- Code: ---E.index := 0;
while(E.index < 10,
Debug("Index is", E.index);
E.index := E.index + 1;
);

--- End code ---

I'm not sure, if you need it here, though. Why do you need the weapons in seperate variables? Why not just put them in a selection / in an array?

Mularac:
I need it because in one mission the player has to choose wich weapon it wants to fix or not, in a dialog. And each dialog is connected to the weapon in question, and that weapon can only be connected to the game via a variable.

Mularac:
I've got a question.. for the past few days I've been trying to select two different devicetypes (supp_bsgen and supp_res) with the selectdevices rules, so that they may be activated with the enbladevice command. (and no, enabling them with two separate SelectDevices commands doesn't count). Or, in other words, I need to put those devices into a variable useful for the EnableDevice command.
Somehow, writing

--- Code: ---SelectDevices(1, m.*ship*, s.this:Devtype=#supp_BsGen & s.this:Devtype=#supp_res);

--- End code ---
doesn't work, and writing a list and using the additem command doesn't work either... here's the rule I'm working with atm:


--- Code: ---SelectDevices(1, m.ac,  InSet(s.this,66));
Execlist(1,
debug(s.this);
dev:=s.this;
Debug(dev);
);
SelectDevices(2, m.ac, InSet(s.this,65));
Execlist(2,
debug(s.this);
addItem(dev, s.this);
Debug(dev);
);
Debug("----------------The devices are:", dev);
E.time:=250;
m.pgen:=1;
ChangeState(countdown, dev:=dev; E.time:=p.time);


--- End code ---

In the countdown state all that is there is a "EnableDevice(dev, 1);"

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version