Page 53 of 400

Re: Ask a simple question, get a simple answer

Posted: Wed Mar 11, 2015 10:31 pm
by Hei&Yin
What i'm looking for is to get that "+" sign, that lets you add connectors (inside the editor) to a component, to work on a ControllerComponent.
Same as you have on for example a LeverComponent.

For now i am using a LeverComponent instead of a ControllerComponent. but then i need to add an dummy animation, that returns false. Also i get warnings when i don't have an model.

This is just something minor but wanted to ask in case I missed something.

Re: Ask a simple question, get a simple answer

Posted: Wed Mar 11, 2015 10:43 pm
by minmay
Hei&Yin wrote:What i'm looking for is to get that "+" sign, that lets you add connectors (inside the editor) to a component, to work on a ControllerComponent.
Same as you have on for example a LeverComponent.

For now i am using a LeverComponent instead of a ControllerComponent. but then i need to add an dummy animation, that returns false. Also i get warnings when i don't have an model.

This is just something minor but wanted to ask in case I missed something.
This functionality doesn't exist. ControllerComponent doesn't have any connector events. However, instead of using LeverComponent for your hack, you should just use CounterComponent.

Re: Ask a simple question, get a simple answer

Posted: Sun Mar 15, 2015 4:17 am
by AndakRainor
Is it possible to test the existence of a file or list the content of a directory ? Still learning Lua, I just found that the standard io library is unknown in grimrock scripting ?

Re: Ask a simple question, get a simple answer

Posted: Sun Mar 15, 2015 5:00 am
by minmay
No. If it were, it would be an enormous security hole.

Re: Ask a simple question, get a simple answer

Posted: Sun Mar 15, 2015 5:09 am
by AndakRainor
Security holes are fun !!! I was trying to access the portraits directory to populate taverns with generated recruitable champions.

Re: Ask a simple question, get a simple answer

Posted: Tue Mar 17, 2015 6:08 pm
by sajon
Ok i am trying to call a function inside a script_entity form another script_entity but cannot get it to work...

Example:
script_entity_1

Code: Select all

function startSequence()
   print("Sequence started...")
	delayedCall(self.go.id, 1, "sfireball")
   delayedCall(self.go.id, 1.5, "firstEvent")
   delayedCall(self.go.id, 10, "secondEvent")
end

function firstEvent()
   print("This script is run 1.5 seconds after the start.")
end

function secondEvent()
   print("This is printed 10 seconds after start.")
end

function sfireball()
   script_entity_2.fireaway() -- This is where i get an error
end
script_entity_2

Code: Select all

function fireAway()
spawn("fireball_small",1,14,15,1,0)
end
I get error attempt to call field 'fireAway' (a nil value)

What am i doing wrong??

Re: Ask a simple question, get a simple answer

Posted: Tue Mar 17, 2015 6:23 pm
by minmay
script_entity_2.script.fireAway() not script_entity_2.fireaway()

Re: Ask a simple question, get a simple answer

Posted: Tue Mar 17, 2015 6:44 pm
by sajon
minmay wrote:script_entity_2.script.fireAway() not script_entity_2.fireaway()
so i forgot to tell it that it was a script xxxx.script.xxxx()
thanks

Re: Ask a simple question, get a simple answer

Posted: Tue Mar 17, 2015 9:59 pm
by Isaac
sajon wrote:
minmay wrote:script_entity_2.script.fireAway() not script_entity_2.fireaway()
so i forgot to tell it that it was a script xxxx.script.xxxx()
thanks
This is because the *.script is a script component in the object.

Re: Ask a simple question, get a simple answer

Posted: Wed Mar 18, 2015 2:58 am
by sajon
So my scripting is not that good....
i am trying to reset a series of pressure plates

allPlates is the ID's of my pressure plates.
I want to just enable all those plates by a trigger, but i also want to figure out how to use an array to store variables to use in loops.
Here is the code i am trying to get to work but it won't.

Code: Select all

function Plates()
  local allPlates = {"T1_Plate1", "T1_Plate2", "T1_Plate3", "T1_Plate4", "T1_Plate5", "T1_Plate6", "T1_Plate7", "T1_Plate8", "T1_Plate9", "T1_Plate10"}
	--print (allPlates)  
for i=1,10 do allPlates[i].floortrigger:enable(true)
end
end
Thanks for the help...