Oh I made a typo .. Im sorry
Code: Select all
[ENABLE]
{$lua}
if syntaxcheck then return end
local commands = readPointer("cmdList")
if commands == 0 then
print("plaese load a saved game first")
return
end
local size = readInteger(commands + 0x2C)
if size <= 0 then
print("please load a saved game first")
return
elseif size > 3000 then
size = 3000 -- just in case
end
commands = readPointer(commands + 0x20)
COMMAND_SELF = {}
for i = 1, size do
local addr = readPointer(commands)
if addr > 0 then
local name = readPointer(addr + 0x08)
name = readString(name, 256, false)
local self = readPointer(addr + 0x40)
addr = readPointer(addr + 0x48)
COMMAND_SELF[name] = self
if addr > 0x1000 then
unregisterSymbol(name)
registerSymbol(name, addr, true)
end
end
commands = commands + 0x08
end
function PrepareCall(name)
local cmdAddr = getAddress("cmdAddr")
local cmdSelf = getAddress("cmdSelf")
local cmd = getAddress(name)
writePointer(cmdAddr, cmd)
writePointer(cmdSelf, COMMAND_SELF[name])
end
function ExecuteCall(FuncName)
local cmdAddr = getAddress("cmdAddr")
local cmdSelf = getAddress("cmdSelf")
local cmdCall = getAddress("cmdCall")
local cmd = getAddress(FuncName)
writePointer(cmdAddr, cmd)
writePointer(cmdSelf, COMMAND_SELF[FuncName])
return executeCodeEx(0, nil, cmdCall)
end
function GetArgAt(i)
return getAddress("cmdArgs") + 0x10 * i + 0x08
end
function GetStringAt(i)
return getAddress("cmdStr"..i)
end
function ClearArg(i)
SetArgToLong(i, 0)
end
function GetArgAsInteger(i)
local arg = GetArgAt(i)
return readInteger(arg)
end
function SetArgToInteger(i, value)
local arg = GetArgAt(i)
if value == nil then value = 0 end
writeQword(arg, value)
end
function GetArgAsLong(i)
local arg = GetArgAt(i)
return readQword(arg)
end
function SetArgToLong(i, value)
local arg = GetArgAt(i)
if value == nil then value = 0 end
writeQword(arg, value)
end
function GetArgAsFloat(i)
local arg = GetArgAt(i)
return readFloat(arg)
end
function SetArgToFloat(i, value)
local arg = GetArgAt(i)
if value == nil then value = 0 end
writeFloat(arg, value)
end
function SetArgToPointer(i, value)
local arg = GetArgAt(i)
if value == nil then value = 0 end
writePointer(arg, value)
end
function GetArgAsString(i)
local arg = GetArgAt(i)
local value = readPointer(arg)
if value and value > 0 then
return readString(value, 256, false)
end
return nil
end
function SetArgToString(i, value)
local str = GetStringAt(i)
writeString(str, value)
writeBytes(str + #value, 0)
SetArgToPointer(i, str)
end
function GetHostCharacter()
ClearArg(0)
ExecuteCall("GetHostCharacter")
return GetArgAsString(0)
end
function AddPassive(Entity, PassiveID)
SetArgToString(0, Entity)
if type(PassiveID) == "table" then
for i = 1, #PassiveID do
SetArgToString(1, PassiveID[i])
ExecuteCall("AddPassive")
end
else
SetArgToString(1, PassiveID)
return ExecuteCall("AddPassive")
end
end
function AddPassiveToPlayer(PassiveID)
local player = GetHostCharacter()
return AddPassive(player, PassiveID)
end
function AddPassiveToWeapon(PassiveID)
local item = GetEquippedWeapon()
return AddPassive(item, PassiveID)
end
function RemovePassive(Entity, PassiveID)
SetArgToString(0, Entity)
if type(PassiveID) == "table" then
for i = 1, #PassiveID do
local value = PassiveID[i]
SetArgToString(1, value)
ExecuteCall("RemovePassive")
end
else
SetArgToString(1, PassiveID)
return ExecuteCall("RemovePassive")
end
end
function RemovePassiveFromPlayer(PassiveID)
local player = GetHostCharacter()
return RemovePassive(player, PassiveID)
end
function RemovePassiveFromWeapon(PassiveID)
local item = GetEquippedWeapon()
return RemovePassive(item, PassiveID)
end
function AddBoosts(Object, Boosts, SourceID, Cause)
SetArgToString(0, Object)
SetArgToLong(2, SourceID)
SetArgToLong(3, Cause)
if type(Boosts) == "table" then
for i = 1, #Boosts do
SetArgToString(1, Boosts[i])
ExecuteCall("AddBoosts")
end
else
SetArgToString(1, Boosts)
return ExecuteCall("AddBoosts")
end
end
function AddBoostsToPlayer(Boosts)
local player = GetHostCharacter()
return AddBoosts(player, Boosts, 0, 0)
end
function RemoveBoosts(Object, Boosts, RemoveOnlyFirstDescMatch, SourceID, Cause)
SetArgToString(0, Object)
SetArgToLong(2, RemoveOnlyFirstDescMatch)
SetArgToLong(3, SourceID)
SetArgToLong(4, Cause)
if type(Boosts) == "table" then
for i = 1, #Boosts do
SetArgToString(1, Boosts[i])
ExecuteCall("RemoveBoosts")
end
else
SetArgToString(1, Boosts)
return ExecuteCall("RemoveBoosts")
end
end
function RemoveBoostsFromPlayer(Boosts)
local player = GetHostCharacter()
return RemoveBoosts(player, Boosts, 0, 0, 0)
end
function ApplyStatus(Object, Status, Duration, Force, Source)
if Duration == nil then
Duration = -1
end
SetArgToString(0, Object)
SetArgToFloat(2, Duration)
SetArgToLong(3, Force)
SetArgToLong(4, Source)
if type(Status) == "table" then
for i = 1, #Status do
SetArgToString(1, Status[i])
ExecuteCall("ApplyStatus")
end
else
SetArgToString(1, Status)
return ExecuteCall("ApplyStatus")
end
end
function ApplyStatusToPlayer(Status, Duration)
local player = GetHostCharacter()
return ApplyStatus(player, Status, Duration, 1, 0)
end
function ApplyStatusToWeapon(Status)
local item = GetEquippedWeapon()
return ApplyStatus(item, Status, Duration, 1, 0)
end
function RemoveStatus(Target, Status, Cause)
SetArgToString(0, Target)
SetArgToLong(2, Cause)
if type(Status) == "table" then
for i = 1, #Status do
SetArgToString(1, Status[i])
ExecuteCall("RemoveStatus")
end
else
SetArgToString(1, Status)
return ExecuteCall("RemoveStatus")
end
end
function RemoveStatusFromPlayer(Status)
local player = GetHostCharacter()
return RemoveStatus(player, Status, 0)
end
function RemoveStatusFromWeapon(Status)
local item = GetEquippedWeapon()
return RemoveStatus(item, Status, 0)
end
function AddSpell(Character, Spell, ShowNotification, AddContainerSpells)
SetArgToString(0, Character)
SetArgToLong(2, ShowNotification)
SetArgToLong(3, AddContainerSpells)
if type(Spell) == "table" then
for i = 1, #Spell do
SetArgToString(1, Spell[i])
ExecuteCall("AddSpell")
end
else
SetArgToString(1, Status)
return ExecuteCall("AddSpell")
end
end
function AddSpellToPlayer(Spell)
local player = GetHostCharacter()
return AddSpell(player, Spell, 0, 1)
end
function RemoveSpell(Character, Spell, RemoveContainerSpells)
SetArgToString(0, Character)
SetArgToLong(2, RemoveContainerSpells)
if type(Spell) == "table" then
for i = 1, #Spell do
SetArgToString(1, Spell[i])
ExecuteCall("RemoveSpell")
end
else
SetArgToString(1, Status)
return ExecuteCall("RemoveSpell")
end
end
function RemoveSpellFromPlayer(Spell)
local player = GetHostCharacter()
return RemoveSpell(player, Spell, 0)
end
function SetTag(Target, Tag)
SetArgToString(0, Target)
if type(Tag) == "table" then
for i = 1, #Tag do
SetArgToString(1, Tag[i])
ExecuteCall("SetTag")
end
else
SetArgToString(1, Tag)
return ExecuteCall("SetTag")
end
end
function SetTagOnPlayer(Tag)
local player = GetHostCharacter()
return SetTag(player, Tag)
end
function ClearTag(Target, Tag)
SetArgToString(0, Target)
if type(Tag) == "table" then
for i = 1, #Tag do
SetArgToString(1, Tag[i])
ExecuteCall("ClearTag")
end
else
SetArgToString(1, Tag)
return ExecuteCall("ClearTag")
end
end
function ClearTagOnPlayer(Tag)
local player = GetHostCharacter()
return ClearTag(player, Tag)
end
function IsTagged(Target, Tag)
SetArgToString(0, Target)
SetArgToString(1, Tag)
SetArgToLong(2, 0)
local result = ExecuteCall("IsTagged")
if result == 1 then
return GetArgAsInteger(2)
else
return nil
end
end
function IsTaggedOnPlayer(Tag)
local player = GetHostCharacter()
return IsTagged(player, Tag)
end
function SetFlag(Flag, Object, DialogInstance, SendFlagSetEventIfChanged)
SetArgToString(1, Object)
SetArgToLong(2, DialogInstance)
SetArgToLong(3, SendFlagSetEventIfChanged)
if type(Flag) == "table" then
for i = 1, #Flag do
SetArgToString(0, Flag[i])
ExecuteCall("SetFlag")
end
else
SetArgToString(0, Flag)
return ExecuteCall("SetFlag")
end
end
function SetFlagOnPlayer(Flag)
local player = GetHostCharacter()
return SetFlag(Flag, player, 0, 1)
end
function GetFlag(Flag, Object)--: FlagState
SetArgToString(0, Flag)
SetArgToString(1, Object)
SetArgToLong(2, 0)
local result = ExecuteCall("GetFlag")
if result == 1 then
return GetArgAsInteger(2)
else
return nil
end
end
function GetFlagOnPlayer(Flag)
local player = GetHostCharacter()
return GetFlag(Flag, player)
end
function ClearFlag(Flag, Object, DialogInstance, SendFlagClearEventIfChanged)
SetArgToString(1, Object)
SetArgToLong(2, DialogInstance)
SetArgToLong(3, SendFlagClearEventIfChanged)
if type(Flag) == "table" then
for i = 1, #Flag do
SetArgToString(0, Flag[i])
ExecuteCall("ClearFlag")
end
else
SetArgToString(0, Flag)
return ExecuteCall("ClearFlag")
end
end
function ClearFlagOnPlayer(Flag)
local player = GetHostCharacter()
return ClearFlag(Flag, player, 0, 1)
end
function TemplateAddTo(ItemTemplate, InventoryHolder, Count, ShowNotification)
if Count == nil then Count = 1 end
if ShowNotification == nil then ShowNotification = 0 end
SetArgToString(1, InventoryHolder)
SetArgToLong(2, Count)
SetArgToLong(3, ShowNotification)
ExecuteCall("TemplateAddTo")
if type(ItemTemplate) == "table" then
for i = 1, #ItemTemplate do
SetArgToString(0, ItemTemplate[i])
ExecuteCall("TemplateAddTo")
end
else
SetArgToString(0, ItemTemplate)
return ExecuteCall("TemplateAddTo")
end
end
function TemplateAddToPlayer(ItemTemplate, Count)
local player = GetHostCharacter()
return TemplateAddTo(ItemTemplate, player, Count, 1)
end
function GetPosition(Target)--: X: Y: Z
SetArgToString(0, Target)
ClearArg(1)
ClearArg(2)
ClearArg(3)
ExecuteCall("GetPosition")
local x = GetArgAsFloat(1)
local z = GetArgAsFloat(2)
local y = GetArgAsFloat(3)
return x, y, z
end
function GetPositionOfPlayer()
local player = GetHostCharacter()
return GetPosition(player)
end
function CreateAt(TemplateId, X, Y, Z, Temporary, PlaySpawn, SpawnFinishEvent)--: CreatedObject
SetArgToString(0, TemplateId)
SetArgToFloat(1, X)
SetArgToFloat(2, Z)
SetArgToFloat(3, Y)
SetArgToLong(4, Temporary)
SetArgToLong(5, PlaySpawn)
SetArgToLong(6, SpawnFinishEvent)
ClearArg(7)
ExecuteCall("CreateAt")
return GetArgAsString(7)
end
function CreateAtPosition(TemplateId, X, Y, Z)
if X == nil or Y == nil or Z == nil then
X, Y, Z = GetPositionOfPlayer()
end
return CreateAt(TemplateId, X, Y, Z, 0, 0, 0)
end
function CreateAtObject(TemplateId, Anchor, Temporary, PlaySpawn, SpawnFinishEvent, MatchOrientation)--: CreatedObject
SetArgToString(0, TemplateId)
SetArgToString(1, Anchor)
SetArgToLong(2, Temporary)
SetArgToLong(3, PlaySpawn)
SetArgToLong(4, SpawnFinishEvent)
SetArgToLong(5, MatchOrientation)
ClearArg(6)
ExecuteCall("CreateAtObject")
return GetArgAsString(6)
end
function CreateAtPlayer(TemplateId)
local player = GetHostCharacter()
return CreateAtObject(TemplateId, player, 0, 0, 0, 0)
end
function GenerateTreasure(InventoryHolder, TreasureID, Level, Finder)
SetArgToString(0, InventoryHolder)
SetArgToString(1, TreasureID)
SetArgToLong(2, Level)
SetArgToString(3, Finder)
ClearArg(4)
return ExecuteCall("GenerateTreasure")
end
function GenerateTreasureBag(TreasureID)
local player = GetHostCharacter()
local bag = "3e6aac21-333b-4812-a554-376c2d157ba9"
bag = CreateAtObject(bag, player, 0, 0, 0, 0)
GenerateTreasure(bag, TreasureID, 12, player)
return bag
end
function GetEquippedWeapon(Character)
if Character == nil then
Character = GetHostCharacter()
end
SetArgToString(0, Character)
ClearArg(1)
ExecuteCall("GetEquippedWeapon")
return GetArgAsString(1)
end
Slotnames = {
"Helmet",
"Breast",
"Cloak",
"Melee Main Weapon",
"Melee Offhand Weapon",
"Ranged Main Weapon",
"Ranged Offhand Weapon",
"Underwear",
"Boots",
"Gloves",
"Amulet",
"Ring",
"Ring2",
"Wings",
"Horns",
"Overhead",
"MusicalInstrument",
"VanityBody",
"VanityBoots"
}
for i = 1, #Slotnames do
Slotnames[ Slotnames[i] ] = true
end
function GetEquippedItem(Character, Slotname)--: Item
if Slotname == nil then
Slotname = Character
Character = GetHostCharacter()
end
if Slotname == nil then
return nil
end
if Slotnames[Slotname] ~= true then
print("Slotname must be one of the following: " .. table.concat(Slotnames, ", "))
return nil
end
SetArgToString(0, Character)
SetArgToString(1, Slotname)
ClearArg(2)
ExecuteCall("GetEquippedItem")
return GetArgAsString(2)
end
{$asm}
[DISABLE]