Jump to content

Sorting script using a Do-While type loop


JackBlack5150

Recommended Posts

I am in the process of creating my first ever fallout mod -- a safehouse in Goodsprings similar to the "Luxury Hideout" mod. I am trying to get my terminal to sort items. I have NVSE and the geck (with power up NVSE). I have created a FormList and my code is as follows:

 

 

short a

short tempcount

ref ListEntry

ref container

 

set a to 0

set container to GunAmLockerREF

 

Label 1

set ListEntry to (ListGetNthForm GunAmmoList a)

set tempcount to (player.getitemcount ListEntry)

 

if (tempcount > 0)

player.removeitem ListEntry tempcount

container.additem ListEntry tempcount

Else

set a to a + 1

If (a <= ListGetCount GunAmmoList)

goto 1

EndIf

EndIf

 

GunAmmoList is my FormList for all ammo that is used by regular guns. Cipscis Script Validator says there are no errors, yet the code does not work. I go in to the game and access my terminal, and the option to sort the ammo does absolutely nothing.

 

Any help is greatly appreciated.

Link to comment
Share on other sites

I'm assuming this is a result script on the terminal, right?

Two things - you shouldn't declare variables in result scripts, and a Goto/loop is not going to run in a result script.

 

Split it up so that the terminal result script does something like setting GunAmLockerREF.iEnableSort to 1

 

Then on the container, but a menumode or gamemode script to do the actual loop code, guarded by the iEnableSort variable on the container.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...