Miniwindows using VBscript.

Posted by Scarn on Mon 25 Aug 2008 08:40 AM — 16 posts, 71,689 views.

#0
I've tried multiple ways of making miniwindows, however they never seem to work. I've never really learnt advanced VBscript so im not sure how to use other types of script in plugins/triggers etc...

I have 3 years of customised client, I don't want to have to convert that all in Lua, but at the same time I'd love someone to paste a trigger that would load a miniwindow. Once I have the starting frame I can build off it.

Thanks,

Scarn (T2T MUD)
Australia Forum Administrator #1
Right, can you please post what you have attempted? It is hard to debug problems when you don't give any examples.
#2
They are so messy its pointless. To be honest I don't fully understand how it works. Would a trigger run off my prompt to update the window?
#3
I figured it out, im just figuring out how to apply text into the window now. Having problems with "WindowFont"
#4
status = WindowFont (win, "heading", "Trebuchet MS", 28, true, false, false, false)


Error number: -2146827839
Event: Execution of line 1 column 1
Description: Argument not optional: 'WindowFont'


Called by: Immediate execution



-----


I cannot see why WindowFont shouldn't work? Any ideas anyone?
USA #5
For WindowFont you shouldn't need 'a =', just call the function. Also, in testing, it seems the last two arguments (short Charset, short PitchAndFamily) aren't optional in VBscript. Try:

WindowFont win, "heading", "Trebuchet MS", 28, TRUE, FALSE, FALSE, FALSE, 0, 0

Amended on Mon 25 Aug 2008 01:27 PM by Fadedparadox
#6
Same detail :( Its as if WindowFont isn't a recognised command on my version. I have MUSHclient 4.35... hmmm.

Im having the same problem with WindowDraw as well.

Apart from that im making some great coloured boxed *laughs*
#7
I did some more tweaking and for some reason it works now *cheers* All I need to figure out now is why its working, *laughs*
Great feature btw Nick.
Netherlands #8
Make sure you put 'world.' in front of the commands in languages other than Lua. To my knowledge, omitting the world object is only supported in Lua and no other languages.
#9
Im having the same problem with displaying an image...


status = WindowDrawImage (6, "im1", 2, 2, 0, 0, 1)


Error number: -2146827839
Event: Execution of line 20 column 1
Description: Argument not optional: 'WindowDrawImage'


Called by: Immediate execution




I played around but couldn't get anywhere.
Australia Forum Administrator #10
See:

http://www.gammon.com.au/scripts/doc.php?function=WindowDrawImage

WindowDrawImage has the following arguments:


WindowDrawImage (BSTR Name, BSTR ImageId, long Left, long Top, long Right, long Bottom, short Mode, long SrcLeft, long SrcTop, long SrcRight, long SrcBottom);


You haven't supplied them all, which is what the error message is about. (Add 0,0,0,0 to the end). In Lua the last four are optional which is why the examples didn't have them.
#11
<triggers>
<trigger
enabled="y"
expand_variables="y"
match="^HP\:(\d+)\/(\d+) EP\:(\d+)\/(\d+) REG\:* \&gt;$"
name="InfoBar"
regexp="y"
script="DoPrompt"
send_to="12"
sequence="100"
>
<send>setvariable "Health", "%1"
setvariable "Energy", "%3"
setvariable "Region", "%5"

status = WindowCreate ("6", 45,45, 290, 670, 6, 0, ColourNameToRGB (""))

status = WindowLoadImage (6, "im1", "C:/Users/Mark/Pictures/planks.bmp")
status = WindowDrawImage (6, "im1", 2, 2, 0, 0, 1, 0, 0, 0, 0)

status = WindowText (6, "heading", " Bank: @Bank",5, 245, 0, 0,ColourNameToRGB ("white"),false)
status = WindowText (6, "heading", " NPCTarget:",5, 275, 0, 0,ColourNameToRGB ("white"),false)
status = WindowText (6, "heading", " @KillMonster",20, 300, 0, 0,ColourNameToRGB ("white"),false)






status = WindowShow (6, true)







</send>
</trigger>
</triggers>






This trigger fires with no error messages popping up, I can also change the colour of the window however even though loaded - the image fails to appear.
USA #12
I tried your script with an image in that directory and it worked perfectly for me. Try this with a note after each line, like:


status = WindowCreate ("6", 45, 45, 290, 670, 6, 0, ColourNameToRGB ("white"))

Note status

status = WindowLoadImage (6, "im1", "C:/Users/Mark/Pictures/planks.bmp")

Note status

status = WindowDrawImage (6, "im1", 45, 45, 0, 0, 1, 0, 0, 0, 0)

Note status

status = WindowShow (6, true)

Note status


And see if any lines give you an error? All should return 0 (eOK). You won't actually get an error message normally if it doesn't work, even if it returns an error code to status, you have to look at the variable manually.
#13
I placed a "Note status" in and it works fine, thank you!!!
#14
Here is how my client is coming along, thanks for all the help!

http://www.freewebs.com/bethagan/Untitled.jpg


The blank space in the bottom right hand corner; my infobar doesn't stretch across the whole length of the screen. Any way I can fix that?
My next step is to make a miniwindow above the command prompt, containing my Health/Energy etc.. and get away with the INFOBAR all together.

-Scarn.
Amended on Wed 27 Aug 2008 09:14 PM by Scarn
USA #15
That's pretty cool looking. :)