Author Topic: Converting rules to functions  (Read 4413 times)

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Converting rules to functions
« on: 2008-12-13, 04:46:31 PM »
Converting a rule to a function throws an exception if the name new rule name already exists (in my case, the rule tree I was replacing had the name, so if I don't create the rule in the wizard, and create it afterward, it works).

Also, when I typed in a rule name that did work, it seemed to re-make the rule tree by the same name, without regard for the fact that that function already existed.

Also also, it seems that it can't find the function once it's created to put in the dropdown list - Note: When I changed the attribute to just [Description] (because it was already imported in the file I put it in) it was able to find it in the list
« Last Edit: 2008-12-13, 05:19:36 PM by durnurd »
Edward Dassmesser

dutch_619

  • Regular
  • **
  • Posts: 90
    • View Profile
    • Email
Converting rules to functions
« Reply #1 on: 2008-12-13, 08:16:18 PM »
Hmm, so far so good. I'll let you know of any issues with implementation. My game is being built a step at a time, so I am far from being able to run it. I'm still at the stage of using polygons as stand in's for the sprite in order to verify sprite interactions.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Converting rules to functions
« Reply #2 on: 2008-12-13, 11:26:40 PM »
Converting a rule to a function throws an exception if the name new rule name already exists (in my case, the rule tree I was replacing had the name, so if I don't create the rule in the wizard, and create it afterward, it works).

That much I understand.

Also, when I typed in a rule name that did work, it seemed to re-make the rule tree by the same name, without regard for the fact that that function already existed.

I don't understand this.  Are you talking about duplicate rules or duplicate functions or what?  It doesn't let you create duplicate function names does it?

Also also, it seems that it can't find the function once it's created to put in the dropdown list - Note: When I changed the attribute to just [Description] (because it was already imported in the file I put it in) it was able to find it in the list

I also don't understand this.  As soon as I convert a rule into a function and add it to the tree as part of the wizard, it's available to select, and as soon as I select it, the function is right there in the list.  And if I choose not to automatically create the rule, it also shows up in the list.  And I didn't have to edit any code.  It just shows up with the description "Executes rules converted to code from sprite Player".

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Converting rules to functions
« Reply #3 on: 2008-12-14, 08:31:45 AM »
The later problems may have been due to an inconsistency created with the first problem.

First, I tried to make a function and have it called under a rule name that already existed.  It must have created the function here already.
Then, it threw the error, but the wizard window was still open.
Then I changed the rule name and tried again.
Then, it created the same function under the same function name again, and threw an error when I tried to build.
Once I got rid of the second instance, it built and ran, but was not showing up in the dropdown list.  Later, it was.  Not sure why it wasn't before.

Also, after seeing that extending individual sprites is as easy as making a partial class, I thought it might be a nice idea to be able to call functions on specific sprites from a plan.  Of course, you can, (in my case, m_ParentLayer.m_MetalMan.Kill) but it would be nice to have it recognized and selectable somehow in the dropdown list.
« Last Edit: 2008-12-14, 08:35:15 AM by durnurd »
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Converting rules to functions
« Reply #4 on: 2008-12-14, 08:59:29 AM »
(Hope you don't mind if I split this topic)
How did you continue working after the error occurred?  When I get the error, the IDE terminates so I can't continue working in the same environment that had the error.

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: Converting rules to functions
« Reply #5 on: 2008-12-14, 11:42:29 AM »
When I ran it, the error that popped up had Details, Exit (or something like that), and Continue options.
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Converting rules to functions
« Reply #6 on: 2008-12-19, 07:14:58 AM »
Also, after seeing that extending individual sprites is as easy as making a partial class, I thought it might be a nice idea to be able to call functions on specific sprites from a plan.  Of course, you can, (in my case, m_ParentLayer.m_MetalMan.Kill) but it would be nice to have it recognized and selectable somehow in the dropdown list.

I got a pretty slick implementation for calling sprite functions from plans.  Will upload a new beta soon.