Read-only archive of the Armageddon Games Forums Archive (2000–2026) · About this archive

(Possible) ZScript Bug (Please confirm) [536]

3 replies · 1,194 views · Started 23 August 2007

Here is a piece of code I wrote


global script main_script {
void run() {
item drop;
item itm_1;
item itm_2;
item itm_3;
item itm_4;
item itm_5;
int item_num = 1;
while(true) {
if (item_num <= Screen->NumItems()) {
drop = Screen->LoadItem(item_num);
if (drop->Tile == 31165 && drop->CSet != 0) {
drop->Tile = 0;
drop->CSet = 0;
itm_1 = Screen->CreateItem(150);
itm_1->X = (drop->X-4)+Rand(8);
itm_1->Y = (drop->Y-4)+Rand(8);

}
item_num += 1;
}
else { item_num = 1; }
Waitframe();
}
}
}

The bug shows up here:


if (drop->Tile == 31165 && drop->CSet != 0) {
drop->Tile = 0;
drop->CSet = 0;
itm_1 = Screen->CreateItem(150);

What it SHOULD do is:
load each item on the screen (does that fine)
check the tile and cset of each item (here is where the problem is, i'll explain)
then change the tile and cset of the item (that works)
now, when it loops again, the tile = 0 and the cset = 0
BUT the if statement does not seem to respond to that
so it just keeps on creating item id# 150

Now, like I said this is a possible bug. I would like some of the codeing experts to look at this and test it for themselfs to make sure i din't do shumptin stupid :googly:

*BUMP*

I have a theroy on this, I think what may be happening is when the if statement checks the CSet or Tile of an Item it is checking the original settings that were setup in the item editor, even though the script changes those properties the script is not checking for the altered properties.. Just a theroy

Hopefully someone will test this (Lookin at C-Dawg or pkmnfrk as you 2 have shown the most scripting skill and posting activity lately 😊 )

Yes, there is an inconsistency here.

I've added a new item variable, OriginalTile, and clarified in the documentation the role of each.