Jump to content

Need help with my geck script


Skygallant

Recommended Posts

Hello Forum,

 

I have been trying to make a mod for myself where basically I start off with "Matthew's Armour", "Matthew's Knife" and "Matthew's Gun" at the beginning of the game and cant equip anything other than these items. So obviously, scripting would be the method of choice and I've written up something which, I think at least, is fairly robust. I've been working out the bugs but I've gotten to one which I just can't get my head around. It has something to do with the geck's proprietary base forms and base objects system. Something that the likes of which I've never encountered before in a programming language. Anyway, here's the code. The error is at line 58:

ScriptName aaaScriptMatthew

Begin OnEquip player

array_var Slots
array_var SlotsDT
array_var Entry
int x
int y
int z
ref a
ref b
ref c

if eval Player.getItemCount ArmorMatthew == 0 && Player.getItemCount PipBoy == 0
    player.additem ArmorMatthew 1
endif

if eval Player.getItemCount KnifeMatthew == 0 && Player.getItemCount PipBoy == 0
    player.additem KnifeMatthew 1
endif

if eval Player.getItemCount WeaponMatthew == 0 && Player.getItemCount PipBoy == 0
    player.additem WeaponMatthew 1
endif

let x := 0

While x <= 19

	if eval x == 5
            set a to PlayerREF.GetEquippedObject x
        if eval a != KnifeMatthew || a != WeaponMatthew
            player.UnEquipItem a  0 0
        endif
    endif

    if eval x == 2
        set a to PlayerREF.GetEquippedObject x
        if eval a != ArmorMatthew
            player.UnEquipItem a  0 0
        endif
    endif

    let Slots[x] := PlayerREF.GetEquippedObject x

    let x := x + 1
loop

Foreach Entry <- Slots
    let x := Entry["key"]

    if eval Slots[x] == 0
        let SlotsDT[x] := "nada"
        continue
    endif

    let SlotsDT[x] := GetArmorDT Slots[x]
loop

Foreach Entry <- Slots
    let x := Entry["key"]

    if eval SlotsDT[x] == "nada"
        continue
    endif

    if eval SlotsDT[x] > 1
        player.UnEquipItem Slots[x]  0 0
    endif
loop

End
Link to comment
Share on other sites

oh sorry, I was just mindlessly regurgitating what the geck spouted at me. The offending line is :

let SlotsDT[x] := GetArmorDT Slots[x]

The error is:

 

 

SCRIPTS: Script 'aaaScript =Matthew', line 58: Item 'Slots[x]' not found for parameter item. Compiled script not saved!

 

And then it says:

 

 

SCRIPTS: Script 'aaaScriptMatthew', line 58: Could not parse line.

Edited by FactualOrc
Link to comment
Share on other sites

You could try creating a temporary variable right before your GetArmorDT command, as that command only accepts forms. Maybe it doesn't like the array entry you're giving it?

ref armor
let armor := Slots[x]
let SlotsDT[x] := GetArmorDT armor

It's roundabout, but it might work. Store the cell's data as a reference first, then use that reference with GetArmorDT.

Link to comment
Share on other sites

Cool, that stopped the errors anyway :-D I'll hop in game now and give it a whirl. I had to redo the bit at the end as well to:

if eval SlotsDT[x] > 1
    ref armor
    let armor := Slots[x]
    player.UnEquipItem armor  0 0
endif

Lets hope this works, Thanks a bunch

Edited by FactualOrc
Link to comment
Share on other sites

  • Recently Browsing   0 members

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