Author Topic: Help on Hal plugin needed  (Read 12428 times)

Carl2

  • Hero Member
  • *****
  • Posts: 1220
    • View Profile
Help on Hal plugin needed
« on: March 02, 2011, 05:55:08 pm »
  I'm working with Hal 6.2 on a Quad computer, Win 7 64 bit.  I'm using the vrHaptek plugin which I like so much I want to add on or change it.  I simply want to say " wear the pantsuit " to have her change into a pantsuit.jpg.  I'd done it in the past but I'm having problems now.  My frist attempt was to just add it to the vrHaptek plugin, it just didn't work.  To seperate it from the vrFile I made my own plugin called Try.uhp.
I can see it in the brain section of the Options and check or uncheck it.  The frist problem I had was a script error, which caused hal to stop responding, made changes and the error went away and Hal responds now.
Next problem is there is no change of clothing.
This is in   PLUGINAREA1 

If InStr(UserSentence, " wear the pantsuit ") > 0 Then
HalCommands = "<HAPFILE>  LoadSSC.hap  </HAPFILE>"
End If
GetResponse = GetResponse & HalBrain. ChooseSentenceFromFile(WorkingDir)

The LoadSSC.hap will load a SSC.jpg which changes the clothes using drag and drop.  Probably a simple problem but I can't find it.  While trying to fix this I came up with a lot of questions but for now I want to solve the problem of loading the jpg.
Carl2
 

Jake

  • Full Member
  • ***
  • Posts: 146
    • View Profile
    • http://Ainsworth.net
Re: Help on Hal plugin needed
« Reply #1 on: March 02, 2011, 07:14:02 pm »
Could be a problem with it finding the path or the HalCommands statement.
Notice in my code below, the "MsgBox" line that is commented out with a ' in front of it.  Putting MsgBox lines in your code will pop up little messages that will help you debug your code, the one below is telling me what the ja1_inputString is equal to.  Then when it working, you can either delete these MsgBox lines or just comment them out with a ' in case you need them later.

Here's some snips from my basescript plugin that changes skins...

If InStr(ja1_InputString, "chgskin") <> 0 OR InStr(ja1_InputString, "chgclothes") <> 0 OR InStr(ja1_InputString, "chgoutfit") <> 0 Then
 
'MsgBox "ja1_InputString = -" & ja1_InputString & "-"
    If ja1_current_skin = "AudreyElf5_fb_Outfit05_shortsblack01" Then
      ja1_file = "AudreyElf5_fb_Outfit06_magica"
      HalCommands = HalCommands & "<HAPFILE>" & ja1_pathFullbody & ja1_pathCharacters & ja1_file & ".hap" & "</HAPFILE>"
    End If

so... on your code...

If InStr(UserSentence, " wear the pantsuit ") > 0 Then
HalCommands = "<HAPFILE>  LoadSSC.hap  </HAPFILE>"
End If

maybe try...
(Below... insert the path in place of the word [PATH], example c:\myAI\skins\)

HalCommands = HalCommands & "<HAPFILE>" & "[PATH]LoadSSC.hap" & "</HAPFILE>"


So... using the above example of c:\myAI\skins\ the line of code would be...

HalCommands = HalCommands & "<HAPFILE>" & "c:\myAI\skins\LoadSSC.hap" & "</HAPFILE>"


OR... you could simplify {because that line is not using VARS to represent the path parts} and just go with this...

HalCommands = HalCommands & "<HAPFILE> c:\myAI\skins\LoadSSC.hap </HAPFILE>"


« Last Edit: March 02, 2011, 07:24:19 pm by Jake »
Austin, Texas, USA, Earth

Carl2

  • Hero Member
  • *****
  • Posts: 1220
    • View Profile
Re: Help on Hal plugin needed
« Reply #2 on: March 02, 2011, 09:54:05 pm »
  After reading your post I agree, it probably can't find the file and moves on.  The plugin is in Ultra Hal Assistant 6 and the Load hap and jpg is in the characters.  The vrHaptek uses the vrFile 
If InStr(vrUserSentence, "black") > 0 And InStr(vrUserSentence, "hair") > 0 Then
   vrFile = "HairBlack.hap"
   GetResponse = "I changed my hair to black"
End If

so vr has been able to put the path in his vrFile.  I was going to try this while still online but the HapRegestry has problems with IE running at the same time.  Also the new character Alactive has a problem with the audio as I experenced, the HalWindowsCenter has a bootless non jiggly they offer because of this.
  I did get a chance to make a plugin, I'll give your suggestion a try and get back.
Carl2
 

Carl2

  • Hero Member
  • *****
  • Posts: 1220
    • View Profile
Re: Help on Hal plugin needed
« Reply #3 on: March 02, 2011, 10:21:59 pm »
  Just tried it after a few error messages, the last try no error messages but it still isn't loading the jpg.
The second line is now
HalCommands = HalCommands & "<HAPFILE>" & " C:\Program Files (x86)\Zabaware\Ultra Hal Assistant 6\Characters\LoadSSC.hap" & "</HAPFILE>"
Getting late look at it again tomorrow.
Carl2
 

Jake

  • Full Member
  • ***
  • Posts: 146
    • View Profile
    • http://Ainsworth.net
Re: Help on Hal plugin needed
« Reply #4 on: March 02, 2011, 11:44:34 pm »
Try adding the following 2 lines just under your HalCommands = HalCommands line...

UltraHal = UltraHal & HalBrain.StoreVars(HalCommands, Hate, Swear, Insults, Compliment, PrevSent, LastResponseTime, PrevUserSent, CustomMem, GainControl, LastTopicList)

Exit Function


If both don't work, just try the first line.  Let me know what happens.
« Last Edit: March 02, 2011, 11:47:29 pm by Jake »
Austin, Texas, USA, Earth

Carl2

  • Hero Member
  • *****
  • Posts: 1220
    • View Profile
Re: Help on Hal plugin needed
« Reply #5 on: March 03, 2011, 08:59:08 am »
  Okay, the script :
If InStr(UserSentence, " wear the pantsuit ") > 0 Then
HalCommands = HalCommands & "<HAPFILE>" & " C:\Program Files (x86)\Zabaware\Ultra Hal Assistant 6\Characters\LoadSSC.hap" & "</HAPFILE>"
End If
GetResponse = GetResponse & HalBrain. ChooseSentenceFromFile(WorkingDir)
 will not generate any error messages, I get a response from Hal, it will not load the jpg.
  adding one or two lines of the script caused error messages with no response from Hal.
My next thought was to put in a scripted response,
GetResponse = "I will try"
  This should tell me I'm gettiing some output from the script.  I get errors again with no response from Hal.
I'm going to try putting the script in a VB script editor, as I remember it will highlite any errors and make it easier.
Carl2




















 

Jake

  • Full Member
  • ***
  • Posts: 146
    • View Profile
    • http://Ainsworth.net
Re: Help on Hal plugin needed
« Reply #6 on: March 03, 2011, 09:30:24 pm »
Here is something that I've done a few times when I had something that should work...but it did not.

- I would make a copy of my "basescript.uhp" and rename it to basescript.uhp.HOLD".
- Then I would pull everything out of the "basescript.uhp" except for the stuff needed for the part that wasn't working.
- Then I would put a bunch of MsgBox lines in the script at various lines to pop up and let me know the progress of the vars.

Once I found the problem and solved it, I would cut and paste that back into the "basescript.uhp.HOLD", delete the "basescript.uhp" and rename the "basescript.uhp.HOLD" to "basescript.uhp".  It has often been the only way I could simplify things enough to get the problem resolved.
Austin, Texas, USA, Earth

Carl2

  • Hero Member
  • *****
  • Posts: 1220
    • View Profile
Re: Help on Hal plugin needed
« Reply #7 on: March 04, 2011, 07:56:55 am »
  I did a few things yesterday, tried the vb script editor, It looks good in there. It can't run the scrip since it works with the brain.  Could try putting the brain in then putting the script in the brain.  I also looked at some of the scripts being written lately, the Gretta and the HapSwap.  Both seem to be written in a more complex form. 
  I like the idea of the msg box, not sure what I'll try nest at this time.
Carl2
 

Jake

  • Full Member
  • ***
  • Posts: 146
    • View Profile
    • http://Ainsworth.net
Re: Help on Hal plugin needed
« Reply #8 on: March 04, 2011, 02:27:24 pm »
I'm not sure about your script, but with my basescript, I had to MOVE the PLUGIN2 area in the brain to just below the first HALCOMMAND line and make my basescript the PLUGIN2 to get it to work correctly.
Austin, Texas, USA, Earth

Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3853
    • View Profile
Re: Help on Hal plugin needed
« Reply #9 on: March 05, 2011, 07:03:54 am »
Might try inserting something similar to this line: brackets OK

\load [file= [C:\Program Files (x86)\Zabaware\Ultra Hal Assistant 6\Characters\LoadSSC.hap" & "</HAPFILE>"]]

??
In the world of AI it's the thought that counts!

- Art -

Carl2

  • Hero Member
  • *****
  • Posts: 1220
    • View Profile
Re: Help on Hal plugin needed
« Reply #10 on: March 05, 2011, 09:29:31 am »
Art,
  Thanks for taking a look at this and posting, I'll give your reply a shot later today.  The original idea was to add a few lines to VR's vrHaptek plugin. If the user says " wear the pantsuit " then load a .jpg.  This didn't work so I made my plugin with the same if then statement.  Then I had the if then load a hap that loaded the .jpg.  I'm getting more complex and I should be simplifing. 
Carl2
 

Carl2

  • Hero Member
  • *****
  • Posts: 1220
    • View Profile
Re: Help on Hal plugin needed
« Reply #11 on: March 05, 2011, 08:23:42 pm »
  I looked through some of the script posted here at Zabaware and ended up using a line in use. The post said the plugin works, in this case I switched the path and the loaded file name and ended up with this

If InStr(UserSentence, " wear the pantsuit ") > 0 Then
        HalCommands = "<HAPFILE>" & "\Load [file=\load [file= [C:\Program Files (x86)\Zabaware\Ultra Hal Assistant 6\Characters\SSNRMC 2048.jpg]]" & "<HAPFILE>"
End If
GetResponse = GetResponse & HalBrain. ChooseSentenceFromFile(WorkingDir)

 
  I tried the above in Hal, when I clicked the apply there were no error messages.  I switched back to trying to load the .jpg instead of a .hap file to load the .jpg.  Anyways It didn't work again. 
  I think my next step should be loading the lines into the brain.uhp, I'm hoping I will have better luck finding the problem if it is in the brain itself. 
Carl2
 

freddy888

  • Hero Member
  • *****
  • Posts: 1693
    • View Profile
    • AiDreams
Re: Help on Hal plugin needed
« Reply #12 on: March 06, 2011, 05:41:32 am »
Does this work ?

Code: [Select]
If InStr(UserSentence, "wear the pantsuit") > 0 Then
        HalCommands = "<HAPTEXT>" & "\load [file= [C:\Program Files (x86)\Zabaware\Ultra Hal Assistant 6\Characters\SSNRMC 2048.jpg]]" & "<HAPTEXT>"
End If
GetResponse = GetResponse & HalBrain. ChooseSentenceFromFile(WorkingDir)

By the way, you notice the way the code is shown ?  Use the # button when posting your message - doing it like that stops the code getting corrupted.

Carl2

  • Hero Member
  • *****
  • Posts: 1220
    • View Profile
Re: Help on Hal plugin needed
« Reply #13 on: March 06, 2011, 08:17:33 am »
Freddy,
  I used the HAPTEXT first and switched to the HAPFILE and tried again.  I should be using   \settexture[ tex= [a.jpg] ]  which I should try,  although I have a .hap that will load the texture using the  \load  (file =   ..
Also I noticed I had to move the GetResponse out of the If Then statement to avoid an error message and have it work but naturally  the script is different in the ones I have looked at.
  When I have enough time I'm going to throw it in the brain scripting so the errors will mean more to me.
Carl2



 

freddy888

  • Hero Member
  • *****
  • Posts: 1693
    • View Profile
    • AiDreams
Re: Help on Hal plugin needed
« Reply #14 on: March 06, 2011, 08:41:05 am »
I just noticed that last haptext should be :

Code: [Select]
</HAPTEXT>
Notice the slash...

The same with your use of <HAPFILE> - you will need to correct that.