Jump to content

How to call the function right


ThalonMook

Recommended Posts

Hi,

 

I have a problem how to call a function right.

Heres the script I wana use.

Function SetMuni() global
    Bool acComp = 0
    Debug.Notification("Ammo Anz Start!")
    int AnzMuni = MCM.GetModSettingInt("ThalonCompAmmo", "iSliderAmmo:Main")
    Debug.Notification("Anzahl: " + AnzMuni)
    ;Debug.Trace("Anzahl: " + AnzMuni)
    Actor[] playerFollowers = Game.GetPlayerFollowers()
    Actor akActor = playerFollowers[4]
    acComp =  CompEnabled(akActor)
    Debug.Messagebox(akActor.GetDisplayName() + "<br>Aktiv: " + acComp)
EndFunction

Bool Function CompEnabled(Actor coActor)
    If (MCM.GetModSettingInt("ThalonCompAmmo", "bEnabledDeacon:Main") && coActor.GetFormID() == 0x50976)
        return true
    ElseIf (MCM.GetModSettingInt("ThalonCompAmmo", "bEnabledVex:Main") && coActor.GetFormID() == 0x49002e1a)
        return true
    ElseIf (MCM.GetModSettingInt("ThalonCompAmmo", "bEnabledPiper:Main") && coActor.GetFormID() == 0x49002e1a)
        return true
    ElseIf (MCM.GetModSettingInt("ThalonCompAmmo", "bEnabledCait:Main") && coActor.GetFormID() == 0x79305)
        return true
    ElseIf (MCM.GetModSettingInt("ThalonCompAmmo", "bEnabledMcCready:Main") && coActor.GetFormID() == 0x2a8a7)
        return true
    Endif
    return false
EndFunction

This error I got from compiler:

 

cannot call member function CompEnabled in global function setmuni without a variable to call it on

 

How I have to call the function?

 

The 'SetMuni' function I have to declare as global cause I want to start it via hotkey 'cgf "myscript.SetMuni"

If there is an other way to start it then I need to know how :-)

 

Thx

Thalon

Link to comment
Share on other sites

  • 4 months later...
  • Recently Browsing   0 members

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