Page 39 of 400
Re: Ask a simple question, get a simple answer
Posted: Tue Jan 06, 2015 4:29 pm
by AndakRainor
Do we know how many icons and spellIcons exist in the default atlases ? It seems to accept high int numbers, too high to test them all... Is there a cyclic reference past the max icon ID ?
Re: Ask a simple question, get a simple answer
Posted: Tue Jan 06, 2015 4:56 pm
by AndakRainor
Ok I checked it, there are 25 spellIcons (0 to 24) and 120 icons (0 to 119) in the default atlas if it can help anyone !
Re: Ask a simple question, get a simple answer
Posted: Fri Jan 09, 2015 6:20 pm
by cameronC
is there a correct way for loadFile in a Script component to be called correctly in a definition? Basically I have a script entity with multiple, specifically named Script components that I want to load from an external file without selecting the files in the editor. It's really not too big of a deal, just curious... Or is there a better way to do this?
Re: Ask a simple question, get a simple answer
Posted: Tue Jan 13, 2015 7:17 am
by Isaac
Is the method of damage calculation known for melee weapons? The range varies quite a bit depending on strength, skill, and the weapon used.
I'd like to be able to approximate the likely attack damage by a given champion with a given weapon ~by inspecting the skills, weapon, and stats.
Re: Ask a simple question, get a simple answer
Posted: Tue Jan 13, 2015 8:10 am
by minmay
Isaac wrote:Is the method of damage calculation known for melee weapons? The range varies quite a bit depending on strength, skill, and the weapon used.
I'd like to be able to approximate the likely attack damage by a given champion with a given weapon ~by inspecting the skills, weapon, and stats.
The average damage for an attack with X attack power is X, according to calcDamage().
Re: Ask a simple question, get a simple answer
Posted: Thu Jan 15, 2015 9:16 am
by grimMod
Hi,
creating my first mod and noticed something.
If calling a scriptfunction with parameter directly from another script (or console) it sends an extra parameter. delayedCall does not.
Calling from another script with scriptobject.script:functionname(param1, param2): The function will receive a table as first param, not param1. param2 will be received as original param1. The table seems to be the receivers script component.
Calling from console with scriptobject.script:functionname(param1, param2) seems to behave the same as above.
Calling with delayedcall("scriptobject",0,"functionname","param1","param2") works and the function receives the correct parameters.
Is this intended or a bug?
To recreate:
Create two script entities in map, script_entity_1 and script_entity_2.
script_entity_1 code:
function doSomething(param1, param2)
print("type(param1): "..type(param1).." type(param2): "..type(param2))
if type(param1) == "table" then print("param1(table): "..param1.go.id) end
if type(param1) == "string" then print("param1(string): "..param1) end
if type(param2) == "string" then print("param2(string): "..param2) end
end
script_entity_2 code:
print(">>>>")
function startit()
delayedCall("script_entity_1", 2, "doSomething", "delayedcallp1", "delayedcallp2")
script_entity_1.script:doSomething("directp1", "directp2")
end
Then put a floor trigger with connector to script_entity_2:startit and step on the floor trigger. Watch the result in the console.
Re: Ask a simple question, get a simple answer
Posted: Thu Jan 15, 2015 9:30 am
by minmay
grimMod wrote:Hi,
creating my first mod and noticed something.
If calling a scriptfunction with parameter directly from another script (or console) it sends an extra parameter. delayedCall does not.
Calling from another script with scriptobject.script:functionname(param1, param2): The function will receive a table as first param, not param1. param2 will be received as original param1. The table seems to be the receivers script component.
Calling from console with scriptobject.script:functionname(param1, param2) seems to behave the same as above.
Calling with delayedcall("scriptobject",0,"functionname","param1","param2") works and the function receives the correct parameters.
Is this intended or a bug?
Lua 5.2 Reference Manual
You might find this useful to read as well:
http://en.wikipedia.org/wiki/Object-ori ... rogramming
"scriptobject" is a table with a field named "script".
"script", in turn, is a table with a field named "functionname".
If you call it with "script.functionname()", the function is called "unbound", i.e. "normally".
If you call it with "script:functionname()", the function is called "bound", i.e. script will be passed as the first parameter. This is Lua's equivalent to methods. It's the same as calling "script.functionname(script)".
Re: Ask a simple question, get a simple answer
Posted: Thu Jan 15, 2015 10:10 am
by grimMod
minmay wrote:grimMod wrote:Hi,
creating my first mod and noticed something.
If calling a scriptfunction with parameter directly from another script (or console) it sends an extra parameter. delayedCall does not.
Calling from another script with scriptobject.script:functionname(param1, param2): The function will receive a table as first param, not param1. param2 will be received as original param1. The table seems to be the receivers script component.
Calling from console with scriptobject.script:functionname(param1, param2) seems to behave the same as above.
Calling with delayedcall("scriptobject",0,"functionname","param1","param2") works and the function receives the correct parameters.
Is this intended or a bug?
Lua 5.2 Reference Manual
You might find this useful to read as well:
http://en.wikipedia.org/wiki/Object-ori ... rogramming
"scriptobject" is a table with a field named "script".
"script", in turn, is a table with a field named "functionname".
If you call it with "script.functionname()", the function is called "unbound", i.e. "normally".
If you call it with "script:functionname()", the function is called "bound", i.e. script will be passed as the first parameter. This is Lua's equivalent to methods. It's the same as calling "script.functionname(script)".
Thanks for clearing up my confusion
![Smile :)](./images/smilies/icon_e_smile.gif)
Re: Ask a simple question, get a simple answer
Posted: Sun Jan 18, 2015 6:53 pm
by Vandalar
Hello everyone,
Here's my first question :
Is there a way to close the player/champion inventory if it is open ?
Context : I defined a onClick event for a npc/statue, but if the player fiddle/manipulate things in the inventory while the dialog of the npc is in progress, it send another "onClick", which force the npc to go through the next set of dialog/speech. I could remove the onClick connector/hook while the speech is in progress, but I would rather know how to close the inventory (and for my own education !)
I assume it's related to the party object, so I checked the Scripting Reference, but I couldn't find anything for closing inventory. The closest thing I found was :
Code: Select all
PartyComponent.onDrawInventory(self, context, champion)
but I don't know how I can use it, if I can use it at all.
Thanks in advance,
PS : Sorry for any spelling/grammar error. English second language here.
Re: Ask a simple question, get a simple answer
Posted: Thu Jan 22, 2015 8:52 pm
by quailman84
How does one reference a variable found in a script from the console or from a different script entity? I found a Grimrock 1 thread saying that you just do (scripting entity id).(variable name), but I can't get that to work. Is the process different in Grimrock 2, or am I just being dense?
For clarity's sake, this is what I am doing: I create a script entity with the id "se". The script embedded in that entity consists solely of the line "foo = 1". No functions or anything, just that line. Then, if I create a script that prints se.foo, it prints nil. Same for if I reference or print se.foo from the console.
Thanks in advance for any help offered.
Edit: Figures I solve the problem on my own just minutes after wrestling with it for an hour and registering here just so I could ask. By accessing se, I was only accessing the game object, not the script contained within the game object. To access the script, you need to do se.script, and therefore se.script.foo to access the variable found inside the script.