[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  How to use CallPlugin with gmcpval
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: How to use CallPlugin with gmcpval
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please)
Maximum of 6000 characters. Text only please, no HTML.
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Whininguser   Canada  (30 posts)  [Biography] bio
Date Thu 17 Nov 2011 04:33 AM (UTC)  quote  ]
Message
Got it. Thanks guys.
[Go to top] top

Posted by Nick Gammon   Australia  (19,534 posts)  [Biography] bio   Forum Administrator
Date Thu 17 Nov 2011 04:28 AM (UTC)  quote  ]
Message
Lose the brackets around CallPlugin. That forces Lua to throw away all returned values except the first. For example:


function foo ()
  return 1, 2
end 

a, b = foo ()

print (a, b)   --> prints: 1, 2

a, b = (foo ())

print (a, b)   --> prints: 1, nil


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Whininguser   Canada  (30 posts)  [Biography] bio
Date Thu 17 Nov 2011 03:42 AM (UTC)  quote  ]

Amended on Thu 17 Nov 2011 04:13 AM (UTC) by Whininguser

Message
I hardly know any Lua, so could you elaborate?

I just tried

err,s = (CallPlugin("3e7dedbe37e44942dd46d264","gmcpval","char.vitals.hp"))

and print(s) showed nil.

I must be doing something wrong, but I have no idea what it is. More help please.
[Go to top] top

Posted by Fiendish   USA  (1,015 posts)  [Biography] bio   Global Moderator
Date Thu 17 Nov 2011 02:29 AM (UTC)  quote  ]

Amended on Thu 17 Nov 2011 02:52 PM (UTC) by Fiendish

Message
instead of s = (CallPlugin...) do
err,s = CallPlugin...
to get the second returned value put into s instead of the first.

http://aardwolfclientpackage.googlecode.com/
https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Whininguser   Canada  (30 posts)  [Biography] bio
Date Thu 17 Nov 2011 12:43 AM (UTC)  quote  ]

Amended on Thu 17 Nov 2011 12:56 AM (UTC) by Whininguser

Message
The client I'm using is right on Aardwolf's homepage.

If I ran this:

print(CallPlugin("3e7dedbe37e44942dd46d264","gmcpval","char.vitals.hp"))

The output would be 0 100, and 100 is my hp. But how can I store this 100 in a script that's not a plugin? I tried doing s = (CallPlugin...) and print(s), and it simply printed 0.

Thanks for any help.
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


1,662 views.

It is now over 60 days since the last post. This thread is closed.   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Web site powered by FutureQuest.Net]