HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.
Pages: 1 [2] 3 4 ... 8

Author Topic: How to make a simple scrollable chat window  (Read 44618 times)

Bonkahe

  • General Accounts
  • *
  • Posts: 29
    • View Profile
Re: How to make a simple scrollable chat window
« Reply #15 on: Jan 07, 12, 01:37:05 PM »

Ok I followed all of this (had to trouble shoot a bit) and it compiled with no errors, but when I actually go in game there is no chat box, on top of that the original no longer shows up, any information?

Edit: Scratch that, worked flawlessly, need to change the text color though.
« Last Edit: Jan 07, 12, 02:22:32 PM by Bonkahe »
Logged

LastJudge

  • General Accounts
  • *
  • Posts: 215
    • View Profile
Re: How to make a simple scrollable chat window
« Reply #16 on: Jan 07, 12, 02:39:22 PM »

I've got a problem.

I created my own ability bar but is doesn't work  .. the script is similar to default ability bar. I have it placed on my screen but it ignores mouse events (even though the icons should not).

Do I need to change reference from E_AbilityBar to my ability bar anywhere else besides E_playerAccountClassMethods?
Logged

Jrome90

  • General Accounts
  • *
  • Posts: 330
    • View Profile
Re: How to make a simple scrollable chat window
« Reply #17 on: Jan 07, 12, 05:32:53 PM »

Ok I followed all of this (had to trouble shoot a bit) and it compiled with no errors, but when I actually go in game there is no chat box, on top of that the original no longer shows up, any information?

Edit: Scratch that, worked flawlessly, need to change the text color though.

Good to hear you got it working.
What is it you had to trouble shoot?
Logged

Jrome90

  • General Accounts
  • *
  • Posts: 330
    • View Profile
Re: How to make a simple scrollable chat window
« Reply #18 on: Jan 07, 12, 06:06:18 PM »

I've got a problem.

I created my own ability bar but is doesn't work  .. the script is similar to default ability bar. I have it placed on my screen but it ignores mouse events (even though the icons should not).

Do I need to change reference from E_AbilityBar to my ability bar anywhere else besides E_playerAccountClassMethods?

I just did a quick test. I coppied the default "E_AbilityBar" GUI xml, and created a new one named "T_AbilityBar". Then set the color to red, so I can see if it is using the new one.

After setting up the Class in the DOM, and copying the "E_AbilitybarClassMethods" script to my new script "T_AbilityBarClassMethods".
Next I changed the two lines in "E_PlayerAccountClassMethods" that create the GUI.

Everything Works as expected.
You don't need to change any other scripts to get it to work.

Did you copy the xml from the "E_AbilityBar" GUI XML to your new one?
Logged

Bonkahe

  • General Accounts
  • *
  • Posts: 29
    • View Profile
Re: How to make a simple scrollable chat window
« Reply #19 on: Jan 07, 12, 06:29:04 PM »

Ok I followed all of this (had to trouble shoot a bit) and it compiled with no errors, but when I actually go in game there is no chat box, on top of that the original no longer shows up, any information?

Edit: Scratch that, worked flawlessly, need to change the text color though.

Good to hear you got it working.
What is it you had to trouble shoot?

I had the same issue with the children() that other people had. then I had a problem with E_ChatHandlerClassMethods

Code: [Select]
//method GetChatInputBox() as
     NodeRef of Class TMP_ChatWindow
//  return FindGUIControlByName( None,"E_ChatInputBox" )
//.

at the end I had to change to:

Code: [Select]
//method GetChatInputBox() as
//     NodeRef of Class TMP_ChatWindow
//  return FindGUIControlByName( None,"E_ChatInputBox" )
//.
Logged

LastJudge

  • General Accounts
  • *
  • Posts: 215
    • View Profile
Re: How to make a simple scrollable chat window
« Reply #20 on: Jan 07, 12, 06:34:11 PM »

I created a new class for my ability bar TS_AbilityBar (archetype guicontrol, parent class GUIPanel)

copied and modified the original script from E_AbilityBarClassMethods to TS_AbilityBarClassMethods

and created a new GUIXML and made it's structure pretty much the same as E_AbilityBar (inherit from _panel, class is TS_AbilityBar)

and finally changed the lines from E_playerAccountClassMethods to create TS_AbilityBar instead of E_AbilityBar

what works is creating the new ability bar, however it seems to be ignoring mouse events (Ability icons are set to not ignore mouse events)

Edit: I copied the original xml to my new XML and it works. However I found out I need to change a line in E_AbilityClassMethods (a server script) to make the cooldown animation work.

Specifically line 82:
call client me.E_owner.GetMyAccount() E_AbilityBarClassMethods::timeoutability(me.E_script:GetAbilityName(), me.E_script:GetAbilityCooldown().secondsTotal)

just changed E_AbilityBarClassMethods to TS_AbilityBarClassMethods to it calls the right script
« Last Edit: Jan 08, 12, 07:48:58 AM by LastJudge »
Logged

Jrome90

  • General Accounts
  • *
  • Posts: 330
    • View Profile
Re: How to make a simple scrollable chat window
« Reply #21 on: Jan 08, 12, 05:36:12 PM »

Did you find any differences in the GUI XML that you created, and the original that you copied?
Logged

LastJudge

  • General Accounts
  • *
  • Posts: 215
    • View Profile
Re: How to make a simple scrollable chat window
« Reply #22 on: Jan 08, 12, 05:44:06 PM »

Did you find any differences in the GUI XML that you created, and the original that you copied?

Not really. I still don't know where the problem was. I think the only relevant part for mouse interaction is making everything but ability icons ignore mouse events. And my ability icons were the only thing that didn't ignore mouse events. I don't think any other properties I changed might have had an effect on this.

Right now I'm having another tiny problem and that's my target status bar. It displays all it should (name, level and health) but it doesn't update itself. I target an NPC and cast fireball so it's hp must surely drop, the status bar however doesn't update until I re-target that NPC again. I think there must be some line in a some script I don't know yet that I need to change. Because pretty much the same code works for player status bar without any trouble. As soon as I find and fix it, I might post another tutorial :)

Edit: which reminds of something I wanted to ask for quite some time but I always forgot to ... is there any way I can search multiple scripts (ideally all of them) at a time to see if they contain a phrase or a word?
« Last Edit: Jan 08, 12, 05:54:56 PM by LastJudge »
Logged

Jrome90

  • General Accounts
  • *
  • Posts: 330
    • View Profile
Re: How to make a simple scrollable chat window
« Reply #23 on: Jan 09, 12, 03:51:55 AM »

To search all scripts (Either Client or Server)  in the Script editor of course, Go to Search>Find in all Scripts or
Hit Ctrl+Shit+A

There are a few changes you need to make to have the status bar update automatically.

As for everything but the abilty icons ignoring mouse events. I tested that by setting others to not ignore mouse events..
It didn't make a difference, it still works. But I don't know
« Last Edit: Jan 09, 12, 03:53:31 AM by Jrome90 »
Logged

Jrome90

  • General Accounts
  • *
  • Posts: 330
    • View Profile
Re: How to make a simple scrollable chat window
« Reply #24 on: Jan 09, 12, 04:01:02 AM »

The changes I needed to make to make the status bar update are

In Client Side E_PlayerCharacterClassMethods (Line 16-29)
Code: [Select]
shared function _OnReplicationFieldUpdated(updateNode as NodeRef, updateField as String)
  when toLower(updateField)
    is "e_experiencepoints"
      $LightweightEvents.raiseLightweightEvent(updateNode, "xpUpdated", None) 
    .
    is "name"
      $LightweightEvents.raiseLightweightEvent(updateNode, "nameUpdated", 0)
    .
    is "e_hitpoints"     
      $LightweightEvents.raiseLightweightEvent(updateNode, "hpUpdated", 0)
    .
    is "e_level"
      if $BASECLIENT._AreaID = 93383990054
        return
      .
      $LightweightEvents.raiseLightweightEvent(updateNode, "levelUpdated", 0)     
      me.EquipPlayerWeapon()
    .
And
Client side E_StatusBarClassmethods

Code: [Select]
method lightweightEventRaised(subject as ID, eventType as String, data as NodeRef)
  when eventType
    is "nameUpdated"
      char as NodeRef of Class E_CommonCharacter = subject
      if char != None
        me.SetName(char.name)
      .     
    .
    is "hpUpdated"
      char as NodeRef of Class E_CommonCharacter = subject
      if char != None
        me.SetHP(char.E_hitPoints)
      . 
    .
   is "levelUpdated"
//     char as NodeRef of Class E_playerCharacter = subject
     char as NodeRef of Class RO_playerCharacter = subject

      me.Level(char.E_level)
      //only for quick testing (isnt working)
      //me.ItemEquip(char.E_level)
    .
  .
.
method SetName(name as String)
  nameLabel as NodeRef of Class GUILabel = FindGUIControlByName(me,"nameLabel")
  nameLabel.text = name
.

method Level(level as Integer)
  lvl as NodeRef of Class GUILabel = FindGUIControlByName(me,"levelLabel")
  lvl.text = "Level: " + level
.

method SetHP(hp copies Integer)
  if hp < 0
    hp = 0
  .
  healthP as NodeRef of Class GUILabel = FindGUIControlByName(me,"HP")
  healthP.defaultStatePresentation.color.r = 1
  healthP.defaultStatePresentation.color.g = 1
  healthP.defaultStatePresentation.color.b = 1
 
  healthP.text = ""+hp+"/100" // Still Static :(
 
  healthSlider as NodeRef of Class GUIControl = FindGUIControlByName(me, "healthPanel.healthSlider")
  healthSlider.removeAnimations()
  var size = -1.0 * hp
« Last Edit: Jan 09, 12, 04:10:14 AM by Jrome90 »
Logged

LastJudge

  • General Accounts
  • *
  • Posts: 215
    • View Profile
Re: How to make a simple scrollable chat window
« Reply #25 on: Jan 09, 12, 04:04:29 AM »

Yeah, I already found that shortcut in another thread yesterday, but thanks anyways. I hope I can get it all to work today :)

Well the ability bar doesn't matter for me anymore. It works and I like to follow a good advice "if it works, don't mess with it" :D  As long as it works I fine. I'm gonna change the code anyways (I want drag and drop functionality and other funny stuff, the texture might be changed, but overall layout and structure probably won't be getting any large changes that should somehow affect it. I don't have the old xml anymore so it would be hard to find out where the problem was anyways.

Thanks for the status bar hint :)
Logged

Jrome90

  • General Accounts
  • *
  • Posts: 330
    • View Profile
Re: How to make a simple scrollable chat window
« Reply #26 on: Jan 09, 12, 04:28:57 AM »

Yeah, I already found that shortcut in another thread yesterday, but thanks anyways. I hope I can get it all to work today :)

Well the ability bar doesn't matter for me anymore. It works and I like to follow a good advice "if it works, don't mess with it" :D  As long as it works I fine. I'm gonna change the code anyways (I want drag and drop functionality and other funny stuff, the texture might be changed, but overall layout and structure probably won't be getting any large changes that should somehow affect it. I don't have the old xml anymore so it would be hard to find out where the problem was anyways.

Thanks for the status bar hint :)

Actually, now that i think of it I don't remember changing anything but adding the level dsiplay, and the number to display the amount of HP..
Sorry if I mislead you..
Logged

LastJudge

  • General Accounts
  • *
  • Posts: 215
    • View Profile
Re: How to make a simple scrollable chat window
« Reply #27 on: Jan 09, 12, 04:44:49 AM »

Now that I read it more carefully I see you meant player status bar ... that works for me without problems ... what I need to fix is target status bar, but now that I know how to search all scripts it shouldn't be a problem.
Logged

Jrome90

  • General Accounts
  • *
  • Posts: 330
    • View Profile
Re: How to make a simple scrollable chat window
« Reply #28 on: Jan 09, 12, 04:48:27 AM »

Now that I read it more carefully I see you meant player status bar ... that works for me without problems ... what I need to fix is target status bar, but now that I know how to search all scripts it shouldn't be a problem.
Yep, I misread what you said.
My mistake.
Logged

LastJudge

  • General Accounts
  • *
  • Posts: 215
    • View Profile
Re: How to make a simple scrollable chat window
« Reply #29 on: Jan 09, 12, 05:32:24 AM »

I fixed it. I'm so damn blind :D

I was using script from player status bar and in that script I checked if it's a player character or not (I check it before 'when'), if it's not, I'm not gonna do anything obviously. And when copying parts of original script to target status bar I forgot to change E_playerCharacter to E_CommonCharacter.
Logged
Pages: 1 [2] 3 4 ... 8