The Daily Click ::. Forums ::. Klik Coding Help ::. LUA - Loosing my Mind, please help!
 

Post Reply  Post Oekaki 
 

Posted By Message

Matthew J



Registered
  06/10/2010
Points
  108
10th September, 2012 at 10/09/2012 07:13:49 -

I'm having no problem calling functions from my LUA script into MMF, but how do I pull data from MMF into my LUA Script?

Sample of what im trying to do:

function getQuest(questid)
return questid
end

////

if getQuest == 1 then
say("Generic quest talk")
else
say("You are not on this quest!")
end

in MMF I have it set to

on function getQuest then 'Lua Object' mmf returns global string A

and nothing happens :/ wont say either one..

heres my 2 Lua Files:


script = coroutine.create(runscript)

function resume()
coroutine.resume(script)
end

function pause()
coroutine.yield(script)
end

function say(text)
DoCall("say",text)
end

function questID(test)
DoCall("questID", test)
end

function quit()
DoCall("quit")
end


and second file


function runscript()


if questID(test) == ace then

say("This is the second test!")
pause();
say("Successful!")
pause();

else

say("You are not on this quest!")
pause();


end


Edited by Matthew J

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
11th September, 2012 at 11/09/2012 02:02:15 -

What Lua object are you using? Make sure you are using the most recent one!

Also I saw that you posted this on the Clickteam forums too, so I'll link it here:
http://community.clickteam.com/showthread.php?t=73081

Someone there will most likely help you since this is a more advanced question.

If you fail to get an answer I'll dig up an example file I have somewhere of what you're trying to achieve.

 
n/a

Matthew J



Registered
  06/10/2010
Points
  108
11th September, 2012 at 11/09/2012 21:20:11 -

Thanks urban, I'll message you in the next couple days if it comes up with nothing! I just not sure what I could be doing wrong, tried pretty much everything logical that I can think of. I'm not too familiar with LUA but have experience with Java/C++ so was taking my best educated guesses at trying to get what I'm trying to achieve haha.

I did some LUA research online too but I guess the way MMF2 and LUA interact was causing a bit of confusion as well.

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
12th September, 2012 at 12/09/2012 01:15:03 -

Well if you're building some sort of editor for your game then it's useful for building game scripts for quests and such.

BUT if it's speed you're going for then you'll need to use the MMF interacting library (I think that's what it's called) It allows you to reference objects directly in your lua code by dumping the object ID's to a table.

It's a rather large dll last I checked though.
You'll have to ask Pixel Thief about that one though.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click