Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Plugins
➜ Clickable Miniwindow
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1 2
Posted by
| Indico
(16 posts) Bio
|
Date
| Sat 20 Feb 2010 10:39 PM (UTC) |
Message
| Is this even possible? I ask because the character I use has many different hand strikes that he can use directly after a sword strike. Ideally, I would like to create a miniwindow that lists all the different areas I can strike, and upon clicking one, it would create a variable that the game can use. However, I have an infintesimal amount of coding experience and have absolutely no idea where to begin. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sat 20 Feb 2010 11:10 PM (UTC) |
Message
| |
Posted by
| Indico
(16 posts) Bio
|
Date
| Reply #2 on Mon 01 Mar 2010 10:12 PM (UTC) |
Message
| Ok, so far I've created an image file and tried to use the guides provided to put it in the miniwindow. The image is a 300 x 355 bmp showing a human silhouette with various lines pointing to the different points that my character can strike, and can be seen here.
http://img46.imageshack.us/img46/6660/striking.png
I then tried to draw this in a miniwindow using this script,
win = GetPluginID ()
WindowCreate(win, 0, 0, 300, 355, 7, 0, ColourNameToRGB("white"))
WindowShow (win, true)
WindowLoadImage(win, "im1", "C:/program files/mushclient/Striking.bmp")
WindowDrawImage(win, "im1", 0, 0, 0, 0, 1, 0, 0, 0, 0)
,which runs error free but produces no miniwindow.
Is there something wrong with that script? I don't want to try to move forward into the hotboxes until I know what's going on here. | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #3 on Mon 01 Mar 2010 10:19 PM (UTC) |
Message
| Try checking the return values from these functions. An easy way to do that is to use the "check" module, and wrap each call in check(). If an error occurs, it will display it on-screen.
require("check")
check(WindowCreate(win, 0, 0, 300, 355, 7, 0, ColourNameToRGB("white")))
check(WindowShow (win, true))
check(WindowLoadImage(win, "im1", "C:/program files/mushclient/Striking.bmp"))
check(WindowDrawImage(win, "im1", 0, 0, 0, 0, 1, 0, 0, 0, 0))
|
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Indico
(16 posts) Bio
|
Date
| Reply #4 on Mon 01 Mar 2010 11:28 PM (UTC) |
Message
| Well, isn't that useful. Thank you. Well, now I know that the function doesn't seem to be able to open my image file, even though I copied and pasted it's file name. | Top |
|
Posted by
| Indico
(16 posts) Bio
|
Date
| Reply #5 on Tue 02 Mar 2010 04:02 AM (UTC) |
Message
| Past one problem and on to another, gotta love it. So I've gone through and created text boxes and hot spots in my miniwindow for all 17 striking points, only problem is, my script isn't sending the variables to the World when I do click a spot...so it's kind of useless right now. Here's an example of my current mouseup function, how do I get these variables into the World where I can use them?
function mouseup (flags, hotspot_id)
if hotspot_id == "hs1" then
SetVariable("strikingpoint","temple")
end
if hotspot_id == "hs2" then
SetVariable("strikingpoint","nose")
end
end | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #6 on Tue 02 Mar 2010 04:12 AM (UTC) |
Message
| I'm assuming this is all in a plugin? Well, you can't set a variable outside your plugin space. You can access outside with GetPluginVariable though. It'll probably be easiest for you to just use GetPluginVariable() from the world. |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #7 on Tue 02 Mar 2010 04:42 AM (UTC) |
Message
|
Recent versions of MUSHclient have the "check" functionality automatically loaded into the Lua script space, so you can check things without needing that line. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Indico
(16 posts) Bio
|
Date
| Reply #8 on Tue 02 Mar 2010 04:52 AM (UTC) |
Message
| Is there something that must be done to define the variable in a plugin? Because right now, GetPluginVariable is returning nil. | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #9 on Tue 02 Mar 2010 05:17 AM (UTC) |
Message
| GetPluginVariable("plugin ID here", "variable name"). Make sure you've got your plugin's ID in there, after all you have to tell it what plugin to get the variable from.
Nick: Ahh, thanks, I wasn't sure so I threw it in there anyways. |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Indico
(16 posts) Bio
|
Date
| Reply #10 on Tue 02 Mar 2010 05:40 AM (UTC) |
Message
| See I did GetPluginVariable("plugin ID here", "variable name"), and it wasn't working, so I tried print(GetPluginVariable("plugin ID here", "variable name")), just to see exactly what the return value was, and it always showed nil. | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #11 on Tue 02 Mar 2010 05:44 AM (UTC) |
Message
| Could you paste the code in the plugin that's setting the variable, and the code in the world that's getting it, in [code] tags? |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Indico
(16 posts) Bio
|
Date
| Reply #12 on Tue 02 Mar 2010 05:53 AM (UTC) |
Message
| My code so far creates a window, draws my image in it, creates 17 hotspots that are all mouseup enabled and correspond to different parts of the image, and then it goes on to this.
function mouseup (flags, hotspot_id)
if hotspot_id == "hs1" then
SetVariable("strikingpoint","temple")
end
if hotspot_id =="hs2" then
SetVariable("strikingpoint","nose")
end
if hotspot_id =="hs3" then
SetVariable("strikingpoint","neck")
end
That's all I have as far as setting the varable, and I haven't written a code in the world yet, since the GetVariable thing keeps returning nill.
| Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #13 on Tue 02 Mar 2010 06:01 AM (UTC) |
Message
| Well that's not very helpful now is it, considering that the GetPluginVariable thing seems to be the source of your problems! ;) The plugin code looks like it should work. |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Indico
(16 posts) Bio
|
Date
| Reply #14 on Tue 02 Mar 2010 08:57 AM (UTC) |
Message
| Well that seems to be my last problem, I fixed the plugin so it works perfectly now. GetPluginVariable returns every value that I click, but I can't figure out how to incorporate it into the world.
Right now I have aliases for all my sword strikes like this one.
alias = cen
centreslash @target
strike @target @strikingpoint
Strikingpoint is the crucial variable here. How do I put the value of GetPluginVariable in its place? | 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.
58,143 views.
This is page 1, subject is 2 pages long: 1 2
It is now over 60 days since the last post. This thread is closed.
Refresh page
top