Page 1 of 1
Calling a Script in a Script
Posted: Tue Oct 28, 2014 9:57 am
by Mysterious
Sorry about this. In LOG 1 you called a Script function in a Script like this:
function help()
script_entity_1.Helpscript()
end
It would then run a function called Helpscript in script_entity_1 This does not seem to work anymore. Does anyone know how? thxs

Re: Calling a Script in a Script
Posted: Tue Oct 28, 2014 10:00 am
by cromcrom
maybe :
Code: Select all
function help()
script_entity_1.script.Helpscript()
end
Re: Calling a Script in a Script
Posted: Tue Oct 28, 2014 10:58 am
by Mysterious
Thxs Crom Crom

do I have to do this below to get a dagger to spawn on the Altar.
Code: Select all
function ratscomplete1()
hudPrint("RATIGIN: Ahhh thank you and here is your reward, friends.")
spawn("dagger",5,10,12,0,0,"daggerat") -- Can this be easier, rather than all the coordinates---
altar_4.surface:addItem(daggerat.item)
end
EDIT: Hows the Merchant thing going

Re: Calling a Script in a Script
Posted: Tue Oct 28, 2014 8:11 pm
by Lark
If the script is invoked from an object at the spawn location, then you can use the fact that the first argument to the script is the calling object and you can reference its coordinates:
Code: Select all
function ratscomplete1(caller)
hudPrint("RATIGIN: Ahhh thank you and here is your reward, friends.")
spawn("dagger", caller.go.level, caller.go.x, caller.go.y, caller.go.facing,
caller.go.elevation, "daggerat") -- Reference caller's coordinates---
altar_4.surface:addItem(daggerat.item)
end
You still use the coordinates, but you don't have to keep modifying them every time you move things around. I also thought saw a shortcut where you can spawn something at the location of another object, but I can't find it in the forum right now. I hope this helps. -Lark