Author Topic: vc.SetEventTimer problem  (Read 3836 times)

0 Members and 2 Guests are viewing this topic.

xtermin8r

  • $upporter
  • Sr. Member
  • *****
  • Posts: 366
  • Karma: 9
  • Crunchie
    • View Profile
vc.SetEventTimer problem
« on: April 04, 2013, 09:58:39 AM »
 Hi James

any idea what is wrong with this
Quote
vc.callAction("vc.SetEventTimer","7","Macro Arabic",List[str] (["SPAN","13","14"]))

the error message i get is

104   Python Error:Microsoft.Scripting.ArgumentTypeException: callAction() takes exactly 3 arguments (4 given)
« Last Edit: April 05, 2013, 07:24:44 PM by xtermin8r »
Neural Net Based Artificial Intelligence.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: vc.SetEventTimer problem
« Reply #1 on: April 04, 2013, 01:43:29 PM »
yes.  you are using 4 parameters when you should only be using 3.  I think the error message made that quite clear.

without seeing the whole code, I can't really suggest how to fix it though.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: vc.SetEventTimer problem
« Reply #2 on: April 04, 2013, 01:46:11 PM »
if you look in the wiki the call action method is described like this:

Code: [Select]
void callAction(string strActionType, string strParams, List<string> payloads);
I think the problem here is that you are sending your action parameters wrong.  Try this

Code: [Select]
vc.callAction("vc.SetEventTimer","7&&Macro Arabic",List[str] (["SPAN","13","14"]))

xtermin8r

  • $upporter
  • Sr. Member
  • *****
  • Posts: 366
  • Karma: 9
  • Crunchie
    • View Profile
Re: vc.SetEventTimer problem
« Reply #3 on: April 04, 2013, 03:26:28 PM »
Thanks James, will try it when I get home
Neural Net Based Artificial Intelligence.

xtermin8r

  • $upporter
  • Sr. Member
  • *****
  • Posts: 366
  • Karma: 9
  • Crunchie
    • View Profile
Re: vc.SetEventTimer problem
« Reply #4 on: April 05, 2013, 02:30:39 PM »
hi James

the event is sent after 7 seconds but the payloads have a problem.
Code: [Select]
vc.callAction("vc.SetEventTimer","7&&Macro Arabic",List[str] (["SPAN","13","14"]))
error message: out of range exception value '0' is not valid for 'index' 'index should be between 0 and -1


this works fine
Code: [Select]
vc.triggerEvent("Macro Arabic", List[str] (["SPAN","13","14"]))
« Last Edit: April 05, 2013, 02:58:37 PM by xtermin8r »
Neural Net Based Artificial Intelligence.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: vc.SetEventTimer problem
« Reply #5 on: April 05, 2013, 03:34:50 PM »
the action VC.SetEventTimer takes 2 or more parameters.  You don't need to pass it payloads.  the 3rd parameter will be used as payload1 when the event is fired.
In general most actions don't require you to use payloads at all, you only need to give it parameters.  If the parameters themselves use the terminology {1} then a payload will be required so that the substitution can take place.
the actions that allow us to control VC from python are really just reusing existing methods that VC exposes to plugins, so not everything will appear to make sense at first. ;)

so you should call it like this (the SetEventTimer action is getting sent 5 parameters):
Code: [Select]
VC.callAction("VC.SetEventTimer","7&&Macro Arabic&&SPAN&&13&&14",None)
If you wanted to pass in the list of payloads for some reason you could also write:
Code: [Select]
from System.Collections.Generic import *
vc.callAction("vc.SetEventTimer","2&&Macro Arabic&&{1}&&{2}&&{3}",List[str] (["SPAN","13","14"]))

but I thought the whole point of using python was because you did want to use VC.SetEventTimer !?!?

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: vc.SetEventTimer problem
« Reply #6 on: April 05, 2013, 03:42:36 PM »
hmmm that import got me thinking.  Here is something else to think about...

Code: [Select]
import clr
clr.AddReference("System.Windows.Forms")
 
from System.Windows.Forms import *
MessageBox.Show("I am a message box!","Ta DA!!!")

xtermin8r

  • $upporter
  • Sr. Member
  • *****
  • Posts: 366
  • Karma: 9
  • Crunchie
    • View Profile
Re: vc.SetEventTimer problem
« Reply #7 on: April 05, 2013, 06:35:23 PM »
hola

Code: [Select]
VC.callAction("VC.SetEventTimer","7&&Macro Arabic&&SPAN&&13&&14",None)
does not work   but if i change VC.callAction to vc.callAction it does work.

thank you so much.
« Last Edit: April 05, 2013, 07:22:42 PM by xtermin8r »
Neural Net Based Artificial Intelligence.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: vc.SetEventTimer problem
« Reply #8 on: April 05, 2013, 06:49:44 PM »
 :biglaugh

Right. Sorry about that. Bloody case sensitivity!  I tested with lower case but then changed it trying to improve the readability of my post.  VC actions are not case sensitive, because I specifically wrote code that would ignore case, but in this case python is accessing an object defined in c#, and so it is case sensitive.  Good catch.