Check if plugin is enabled

This forum is meant for requesting technical support or reporting bugs.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

Check if plugin is enabled

Postby Lyberodoggy » Thu Feb 28, 2008 9:39 pm

How can I check using vbs If a plugin is enabled in a frame?
I need my plugin to check if it's enabled in every frame in order to disable its functions in the frames it's not enabled.
Otherwise the user will have to type some code to disable it and that's not what I want.
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby GM-Support » Fri Feb 29, 2008 5:43 pm

Hi Lyberodoggy,

I have just created a tutorial that shows how to make something happen only on the frames where the plugin is enabled.

You will find it at the following URL:
http://www.adventuremaker.com/phpBB2/vi ... php?t=3615


Note: If it does not answer your question because you also want the code entered under the "Startup" tab of the Plugin Properties to know if the plugin is enabled in the current frame or not, follow these steps:
1) From the "Variables" tab of the Plugin Properties, create a global integer variable. Let's call it "MYVAR"
2) From the "Procedures" tab, create a procedure that sets MYVAR to 1 ("MYVAR = 1"). Let's call it "MYSUB".
3) From the "Interface" tab, create an option for the frame properties, and make it call the procedure "MYSUB" that you created at the previous step.
4) From the "Startup" tab, execute the following code every time that a frame is loaded, BEFORE the rest of the plugin code: "MYVAR = 0"
5) Still from the "Startup" tab, execute the following code every time that a frame is loaded, AFTER the rest of the plugin code:
Code: Select all
if MYVAR = 0 then MsgBox "the plugin is not enabled on this frame" else MsgBox "the plugin is enabled on this frame"


Regards,
GM-Support
GM-Support
Forum Admin and Games Page admin
 
Posts: 2221
Joined: Thu Jun 05, 2003 7:52 pm

Postby Lyberodoggy » Fri Feb 29, 2008 7:03 pm

As you will see if you check my plugin (which was uploaded before your post here), I used something like what you described... I made my procedure set a variable to 1 and the frame set it to 0 so it works the same.



Great minds think the same they say :lol:


Anyway it's fixed now but thanks.

Another question: If I add a checkbox in the frame properties, how can I retrieve its value (so as to use it in vbs)?
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby GM-Support » Fri Feb 29, 2008 7:54 pm

Lyberodoggy wrote:As you will see if you check my plugin (which was uploaded before your post here), I used something like what you described... I made my procedure set a variable to 1 and the frame set it to 0 so it works the same

Well done!

Lyberodoggy wrote:Another question: If I add a checkbox in the frame properties, how can I retrieve its value (so as to use it in vbs)?

I just posted a "part 2" of the tutorial that should answer your question:
http://www.adventuremaker.com/phpBB2/vi ... hp?p=13622

Please let me know if it is still not very clear.

GM-Support
GM-Support
Forum Admin and Games Page admin
 
Posts: 2221
Joined: Thu Jun 05, 2003 7:52 pm

Postby Lyberodoggy » Sat Mar 01, 2008 12:17 am

Thanks for the help, but may I ask you something? How did you return the value of the checkbox in the DisplaySeconds variable, since there's no code doing so?
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Lyberodoggy » Sat Mar 01, 2008 12:59 am

To be exact with what I want:
These are the procedures currently run from my plugin:
Code: Select all
Sub load_parser()
project_height=Action.GetProjectHeight
project_width=Action.GetProjectWidth
parser_enabled=1
If project_height=480 Then
   If project_width=640 Then
   LoadControl TextBoxObject(1)
   TextBoxObject(1).Move 12*15,446*15,300*28,30*15
   TextBoxObject(1).Visible = True
   Else
   MsgBox "Parser plugin supports only 640x480, 800x600 and 1024x768 resolutions"
   End If
Else If project_height=600 Then
   If project_width=800 Then
   LoadControl TextBoxObject(1)
   TextBoxObject(1).Move 12*15,568*15,385*28,30*15
   TextBoxObject(1).Visible = True
   Else
   MsgBox "Parser plugin supports only 640x480, 800x600 and 1024x768 resolutions"
   End If
Else If project_height=768 Then
   If project_width=1024 Then
   LoadControl TextBoxObject(1)
   TextBoxObject(1).Move 12*15,733*15,505*28,30*15
   TextBoxObject(1).Visible = True
   Else
   MsgBox "Parser plugin supports only 640x480, 800x600 and 1024x768 resolutions"
   End If
Else
   MsgBox "Parser plugin supports only 640x480, 800x600 and 1024x768 resolutions"
End If
End If
End If
End Sub
Sub read_parser()
Select Case ltrim(rtrim(lcase(TextBoxObject(1).Text)))
   Case "save","save game"
   If save_disabled=0 Then
   Action.PopupSaveGame
   Else
   MsgBox "You are not allowed to save your progress at this time"
   End If
   Case "load","load game"
   Action.PopupLoadGame
   Case "exit","exit game","quit","quit game"
   If MsgBox("Do you really want to quit?", vbYesNo, "Exit Game") = vbYes Then
   Action.Quit
   End If
   Case "take item","get item","get"+item_in_frame
   If item_in_frame <> "" Then
   Action.AddItem item_in_frame
   item_in_frame=""
   item_exist=0
   Else
   MsgBox "There is no item in this place"
   End If
End Select
TextBoxObject(1).Text=""
End Sub

I want to add a procedure like this:
Code: Select all
Sub item_definition(item_exist,item_internal)
If item_exist=1 Then
item_in_frame=item_internal
Else If item_exist=0 Then
item_in_frame=""
End If
End If
End Sub

To enable returning a string containing the internal name of the item in the internal_name variable, which string will be typed in a textbox.
I want to use a textbox and a checkbox in the plugins tab of the frame.
What should I do?
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby GM-Support » Sat Mar 01, 2008 1:34 am

Lyberodoggy wrote:How did you return the value of the checkbox in the DisplaySeconds variable, since there's no code doing so?


This is automatic: Adventure Maker takes care of it :)

Adventure Maker simply takes the value of all the controls (CheckBoxes, TextBoxes, etc.) and sends them as arguments to the "VBScript procedure" that you have specified under the "Interface" tab.

The attached picture should clarify it a little bit.

In the code that you posted, since "read_parser" is the procedure that you call, you should add the two arguments to the "read_parser" procedure itself:
Code: Select all
Sub read_parser(item_exist,item_internal)
If item_exist=1 Then
item_in_frame=item_internal
Else If item_exist=0 Then
item_in_frame=""
End If
End If
Select Case ltrim(rtrim(lcase(TextBoxObject(1).Text)))
'etc.


Please let me know if it is still not very clear.
Attachments
How_interface_values_are_passed.png
How_interface_values_are_passed.png (69.37 KiB) Viewed 2536 times
GM-Support
Forum Admin and Games Page admin
 
Posts: 2221
Joined: Thu Jun 05, 2003 7:52 pm

Postby Lyberodoggy » Sat Mar 01, 2008 8:39 am

Ok thanks... I posted in the other topic before seeing this, so my question there is solved...


Thanks once again for the help :D
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens


Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests

cron