« first day (385 days earlier)      last day (3476 days later) » 

19:00
Awesome!
hmm... but it seems like it just broke
it worked before your two commits
BTW.Reboot
Do my commit override them?
nevermind, it does work
my machine was just confused apparently
restarting npm run develop did the trick
might have been confused by the git pull --rebase I did or something
@SirPython your two recent commits is a step in the right direction, now if attacking would just work properly... ;) (but I guess you are working on that, huh?)
Yup. I'm just about to go reproduce the error so I can check what the server is receiving what problems it's running into.
19:08
[2015-08-22 21:05:31,575] ERROR Log4jAdapter [WebSocketWorker-15] (     Log4jAdapter.java: 21) - Error performing incoming message from 16: Zomis @ /127.0.0.1:55679
java.lang.NullPointerException: Action Attack not found on entity 115
	at java.util.Objects.requireNonNull(Objects.java:228)
	at com.cardshifter.core.game.TCGGame.findAction(TCGGame.java:218)
	at com.cardshifter.core.game.TCGGame.handleMove(TCGGame.java:238)
	at com.cardshifter.server.model.Handlers.useAbility(Handlers.java:145)
seems like it is trying to perform the 'Attack' Action on the entity that you select, not with the entity as target
What about the message that is received?
[2015-08-22 21:05:31,575] INFO ClientWebSocket [WebSocketWorker-15] ( ClientWebSocket.java:104) - Connection message from: org.java_websocket.WebSocketImpl@1c9e4af2: UseAbilityMessage [id=115, action=Attack, gameId=11, performer=0, targets=[165]]
hmm... there it says a target though...
Hmm. The error seems to be that it can't request targets for "attack".
[2015-08-22 21:05:29,551] INFO ClientWebSocket [WebSocketWorker-15] ( ClientWebSocket.java:104) - Connection message from: org.java_websocket.WebSocketImpl@1c9e4af2: com.cardshifter.api.incoming.RequestTargetsMessage@66d82bab
[2015-08-22 21:05:29,551] ERROR Log4jAdapter [WebSocketWorker-15] ( Log4jAdapter.java: 21) - Error performing incoming message from 16: Zomis @ /127.0.0.1:55679
java.lang.NullPointerException: Action Attack not found on entity 115
at java.util.Objects.requireNonNull(Objects.java:228)
well, it can't request targets for an action that doesn't exist
ah, line 55 is wrong
            var getTargets = new CardshifterServerAPI.messageTypes.RequestTargetsMessage(currentUser.game.id,
                                                                                         playerInfos.user.id,
                                                                                         action.action);
line 55 = playerInfos.user.id
it should use action.id there I think
Hmm.
Read the else conditional: it is passing the action ID there.
Possibly the issue is that the attack action is meeting the first condition.
Ah, I think I see the problem.
19:14
That Console-thingy button in the client isn't working for me... isn't it supposed to add something to the bottom or something?
It is supposed to open up to a different screen, I think. @Phrancis would know better.
I see nothing
@Phrancis how does the console button work?
> Some actions with targets, such as `Mulligan`, should not *require* a target. (which makes the `targetRequired` boolean slightly confusing, sorry for that). I mean... it should be possible to target 0 cards.

The `AvailableTargetsMessage` for the Mulligan action is:

AvailableTargetsMessage [entity=115, action=Mulligan, min=0, max=2147483647, targets=[151, 156, 161, 163, 169]]

Notice the `min=0`, that means that it is okay to target 0 cards.
Hmm. I got clicking the "attack" button and clicking a target to work, but I think this needs to be redesigned before the bug can be fixed: right now, after you select a target, you have to click the "attack" button before the attack is executed, when it should actually execute as soon as the target is clicked.
19:20
@SirPython in this particular case, yes. when min=1 and max=1, it should perform the action as soon as the target is clicked.
Is that the same case for all actions where min=1 and max=1?
Ah, that makes things a lot more easy.
thought it would
@SimonAndréForsberg At the moment, it doesn't ;) - But the idea is that upon pressing, it would show the server console towards the bottom, underneath the page content. I've made a console HTML/CSS but it's not been implemented as far as functionality
And of course, pressing it again would hide/remove the console
19:26
oh, okay. I thought the console was working already
It didn't feel the highest priority thing to work on, but once the main sections are functional (they are now, aren't they?) then we can add some bells and whistles like the console
only section that is not functional enough is the game board
I have to fix the top menus too and actually link to content, which I'll get to after I'm done with the deck builder, card model and game board
Can one of you guys take a screenshot of the game board as it is now, next time you have a chance? I'd be curious to see how the different sections are grouped
Why is there a merge conflict in node_modules\karma\node_modules\log4js\test\gelfAppender-test.js.orig ?
<<<<<<< HEAD
        assert.equal(message.facility, 'nodejs-server');
        assert.equal(message.short_message, 'This is a test');
=======
        assert.equal(message.full_message, message.short_message);
        assert.equal(message.full_message, 'This is a test');
>>>>>>> 52b4aa18746bbc7608f892d49c0f0b18a79fc846
oh well, not our code.
@SirPython Do you know of an Angular way to display certain elements on the condition that their content is not null/empty? My use case for instance is to have a "FX" button displayed if the card has an "effect" property, but hide it if it doesn't
19:30
ng-show="card.properties.effect"
I think.
OK I'll try that
Since ng-show only will show if the value is true-y and, in JavaScript, null and "" are false-y
@Phrancis ^^ (i.e. it's horrible)
"" === undefined in JS right?
19:32
Ah
Not that either.
but I don't think even that
Nvm :)
exactly. "" == 0 and many other things, but not "" == undefined.
OK. Well anyways, was just curious :)
@SimonAndréForsberg It's pretty horrible indeed, can't wait to dig into it :)
19:34
false == undefined; // false
false == "";        // true
@SirPython nope, "" == 0 is true
Yes, that's why I deleted it.
right
  0 == ""
  0 == "0"
  0 == " \t\r\n "
  "0" == false
  null == undefined

  ""    != "0"
  false != "false"
  false != undefined
  false != null
Lesson: Always use === and explicit type casting
Hmm. I don't see a way to apply the min and max both being equal to 1 for Attack, because there is no AvailableTargetsMessage.
19:50
@SirPython you should request that message as soon as you click the 'Attack' button
I thought that was causing an error before.
Hey got a question
it was, because it used the wrong id.
@SirPython want me to help you out here a little with the actions thingies?
Sure! Want me to push what I have so far?
19:53
Alright. Lemme finish this test and I'll push.
@Phrancis and the question is...?
The "description" / effect attribute has \n characters, which HTML doesn't display but also ignores completely. If I wanted to replace those with say &#10; or <br/> is there a good way of doing this? Angular or otherwise?
(I'm also open to regex, though never used them in HTML)
trying to get attacking to work

The attack action should work like this:

1. Click the attack button next to a card
2. Click a target
3. IMMEDIATELY attack

The third step has yet to be completed.
1065
Q: Replacing all occurrences of a string in JavaScript

Click UpvoteI have this string: Test abc test test abc test test test abc test test abc Doing str = str.replace('abc', ''); seems to only remove the first occurrence of abc in the string above. How can I replace all occurrences of it?

OK. Could I just add that into an HTML tag (say a p element) with the script attribute on the element?
19:56
@SimonAndréForsberg speaking about what the question is, just though of this one: youtube.com/watch?v=QTXyXuqfBLA
@Phrancis not sure what you mean by that entirely.
Perhaps I'm not either
I think it can work to call the method within Angular.
such as {{some.string.replace(...)}}
@Phrancis So you are looking to replace all the \ns from text before displaying it to the HTML.
Did replace work?
Hmm. string.replace(/\n/g, "") will remove all \ns
20:01
Haven't tried
Oh, I think I understand what you are trying to do.
Can that be appended to {{card.properties.effect}} somehow?
Do you want to preserve the newline effect, or just get rid of it altogether?
Preserve, just replace with a HTML-recognized line break
Well, if &#10 simulates a line break, then you can call string.replace(..., "&#10");
In which scene is this information being displayed?
Or, is this the card model?
20:06
Could I chain string.replace() to the Angular insert {{card.properties.effect}}
Maybe.
There are two things you can try.
First, do this:
@SirPython Right now only in deck builder, but eventually on card model as well
{{$eval(card.properties.effect.replace("/\n/g", "&#10"))}}
^^ Try that. If not, there is an alternative.
20:10
Have fun!
@SirPython that won't help.
@SirPython {{card.properties.effect.replace("/\n/g", "&#10")}} will work the same
and I would do {{card.properties.effect.replace("/\n/g", "<br />")}}
Not sure if &#10; would be as good as <br/>
That
&#10; was my idea, not a good one probably
            <td>{{card.properties.MANA_COST}}</td>
            <td>{{card.properties.ATTACK}}</td>
            <td>{{card.properties.HEALTH}}</td>
            <td>{{card.properties.SICKNESS}}</td>
            <td>{{card.properties.ATTACK_AVAILABLE}}</td>
            <td>{{card.properties.effect.replace("/\n/g", "<br/>")}}</td>
            <td>flavor <!--{{card.properties.flavor}}--> </td>
:\
Looks like that is causing it to not be picked up as Angular
Let me try {{$eval(card.properties.effect.replace("/\n/g", "<br/>"))}} real quick
or {{$eval(card.properties.effect.replace("/\n/g", "... that"))}}
Grumble
hmm...
{{$eval(card.properties.effect.replace(/\n/g, "<br />"))}}
20:23
2
A: AngularJS string replace in html

anpsmnMove the javascript to script.js and return the value angular.module('app', []); function StringCtrl($scope) { $scope.headerText = [{ LabelName: 'Submitted Forms (Form (13G), Form (12C) and etc.,)' }, { LabelName: 'Planned Plans (Plan (13G), Plan (12C) and etc.,)' }, ...

Might make more sense to move that into the JS? ^^
Let me try that though Simon
yeah we can do a solution like that if you don't get it to work
Nope, same thing
Lol, grails create-service X takes a few minutes to run
I have absolutely no clue what it is doing
@SimonAndréForsberg You think that should go in cardshifter.js since it might be used in a few different files? I don't mind putting it into the HTML either, just want to do things intelligently
20:32
@Duga that's unexpected
@Phrancis I don't know. I would ask @SirPython about it.
How do you guys test a WebSocket server that is running on localhost?
@skiwi We don't.
I don't test the websocket server, I test my server.
@Phrancis Thanks, but I was just running an errand ;-)
@SimonAndréForsberg But you need to send messages over the websocket
@Phrancis Definitely not cardshifter.js
20:35
@skiwi but I don't use that to test, I test this: github.com/Zomis/Server/blob/master/src/main/java/net/zomis/…
the only testing of the websocket that I do is manually
but I don't have any tests yet :P
@SirPython OK. How about just a HTML <script> then?
This Chrome extension may work
Or, perhaps we could make a utility_functions.js for things like this
THEN WHY ARE YOU ASKING ABOUT TESTING!?
20:37
Not that either; that's not very flexible with our current AngularJS.
although there's another Java library you can use for making a websocket client
I have a thought:
$scope.showDetails = function(card) {
    var props = card.properties;
    $scope.cardInfo = {
        name: props.name,
        flavor: props.flavor,
        type: props.creatureType,
        health: props.HEALTH,
        attack: props.ATTACK,
        sickness: props.SICKNESS
    };
};
^^ This can be modified at the end to replace the newlines.
@SimonAndréForsberg I gotta know if the code I'm writing executes at some point
@SirPython OK, would it be a matter of adding the missing fields, and the code to process them?
Are you trying to add in effect?
20:38
Yes
Here, I'll try something.
Hmm. Would you find effect like card.properties.effect?
Yeah that's what I use
        <!-- Available {{card.properties}} values
            SERVER JSON name      | AngularJS ref name | Note
            -------------------------------------------------
            "SICKNESS"            | SICKNESS           | 1 or 0, or empty (for cards where n/a)
            "MANA_COST"           | MANA_COST          | n, or empty (for cards n/a)
            "ATTACK"              | ATTACK             | n, or empty (for cards n/a)
            "HEALTH"              | HEALTH             | n, or empty (for cards n/a)
@SirPython don't forget about any possible "UpdateMessages" as well.
Those are being handled.
Grmblbl
I'm never calling server.run()
20:44
Hmm. Replacing newlines with <br /> or &#10; won't work.
I think that it has to be put in a <pre> for newlines to stay.
@SirPython Can I not use jQuery from within an Angular controller?
@SirPython Why wouldn't <br /> work?
You should be able to.
> message test from /127.0.0.1:59522
@SimonAndréForsberg Not entirely sure, but it could be that AngularJS is injecting a string into the HTML, not an entirely new HTML element.
I'd assume you could use $.
Is there a problem with it?
20:47
ReferenceError: $ is not defined
How are you including the jQuery source?
uuum....
Am I including the jQuery source? :)
Probably not ;)
where should I include it?
index.html?
I'm not quite sure how to do it, because it was DanPantry who reorganized the code to have all this package and json and manifest nonsense, but I have an idea on how to do it.
Here, try this:
1. Open up package.json
2. Find "devDependencies"
3. Add a new "entry"
20:51
maybe I should take one thing at a time and not add all things at once :)
4. Key: "jquery" Value: "^<version>"
5. ???
6. Profit.
@SimonAndréForsberg That would be best.
shouldn't some of those devdependencies be in regular dependencies?
I have absolutely no idea.
But, keeping them where they are works, I'm good with that :)
A start^ but not working completely right
(tooltip thing)
Do you have to click on "flavor" to see that box?
20:54
No
Or hover for a few seconds?
[Cardshifter/HTML-Client] Zomis pushed commit 1097319f to game-board: improved actions, it is now possible to attack another creature
@SirPython how's that ^^
Oh, I just realized I need a jQuery plugin to do what I want to do
20:55
still some improvements left though
@Phrancis So do I!
or rather... I just need jQuery
@SimonAndréForsberg You can attack cards now?
That's great!
What do both of you need jQuery for? (specifically)
yes, but now like how it is supposed to work
another commit will come soon
With?
@SirPython add and remove classes from specific HTML elements (add CSS class "targetable" when a card is targetable)
[Cardshifter/HTML-Client] Phrancis pushed commit a6efb291 to sections-layout: Rudimentary tooltip to show flavor, need to install jQuery plugin to do what I think would work best
20:57
Ah, yes, I think we'll need jQuery for that; I tried doing something like that with plain JS a few days ago and it did not work.
@SirPython Some more advanced ways of displaying things that Bootstrap by itself doesn't support, but that are integrated with Bootstrap classes using jQuery
I guess we'll definitely need jQuery for that too.
Try completing the steps I listed above.
            <td><!-- flavor tooltip -->
                <button type="button" class="btn btn-xs btn-default" data-toggle="tooltip" data-placement="top" title="{{card.properties.flavor}}">Flavor</button>
            </td>
^^ example
Oh, let me try the pre for that thing
I'll try add jQuery
Yup, pre works (it'll need some CSS work, but that's the easy part)
Now, what might be tricky, is using a pre block from within the title attribute for a tooltip. For some reason I have a feeling that might not work... just a hunch.
21:03
@SimonAndréForsberg What is going to be changed in your next commit? (I have a change, but I don't want it to interfere)
@SirPython adding and removing classes stuff
after that I will work on performing Attack action as soon as target is selected, if you don't beat me too it
I am capable of handling merge conflicts though, so change all you want :)
Who would've thunk
I'm trying to work on spoofing players as cards so they can be susceptible to attacks, too.
Hmm. I just mulligan'd the enemy.
I don't think I should be able to do that.
@SirPython Impossible.
Impossible it may be, but I won pretty quickly ;)
@SimonAndréForsberg I think there is a problem with your last commit: I tried attacking and then tried playing a card, and the console said target(s) required: 1 - 1 but chosen 0
21:12
@SirPython looking into it
Or maybe it's not a bug in your commit; maybe it's an issue with old code trying to communicate with this code.
[skiwi2/Fragments-Server] skiwi2 pushed commit dd36a0f6 to develop: Added WebSocket server with a simple implementation that echoes the message that has been received.
ng-show worked great :D
@SirPython or maybe it's PICNIC? I'm not sure how you managed to make that happen. You triggered performAction but clicking a 'Play' button is startAction.
$scope.startAction = function(action) {
    if(!action.targetRequired) { // No targets? No confirmation. Do we understand each other?
        $scope.currentAction = action;
        $scope.performAction();
        return;
    }
PICNIC?
A picnic is an excursion at which a meal is eaten outdoors (al fresco or en plein air), ideally taking place in a beautiful landscape such as a park, beside a lake or with an interesting view and possibly at a public event such as before an open-air theatre performance, and usually in summer. Descriptions of picnics show that the idea of a meal that was jointly contributed and was enjoyed out-of-doors were essential to a picnic from the early 19th century. Picnics are often family-oriented but can also be an intimate occasion between two people or a large get-together such as company picnics and...
21:16
@Duga @SimonAndréForsberg Happy now? :)
Only FragmentsServerService feels a little bit odd
@SirPython Problem in Chair not in Computer :)
@SirPython whoops, wasn't aware that you called that method there... I will fix
What's that supposed to mean?
Is that a metaphor?
WHoops.
it means that the user did a problem, not the computer.
but in this case, it was definitely PICNIC (Problem in Computer not in Chair)
21:21
That's a confusing acronym.
@SirPython Wrong button? :p
TTGTTLR
Yes. I wanted to see how you created a table in your README, so I thought hitting "edit" would just show me the source.
Yes, I saw it in my fork. It would've been smarter to just press "Raw"
21:28
[Cardshifter/HTML-Client] Zomis pushed commit 9cafb429 to game-board: fixed actions bug
@SirPython that works for you? ^^
Works perfectly!
Did my steps for injecting jQuery work?
@SirPython well... you forgot one thing... npm install
Yes.
Does it work after that?
21:36
What did you put as the version number?
Do I need var $ = require('jquery'); ??
You could try that (in cardshifter.js)
See Count col
Buttons are a bit mis-aligned, but the idea works pretty good methinks
@SirPython goddamnit. still doesn't work
Hmm. Lemme test something.
21:39
@Phrancis nice
@Phrancis That looks pretty cool.
that's not a jQuery plugin, is it?
No just plain Bootstrap
Aha, I think I've solved it.
@SirPython please, I'm stuck.
21:41
Hold on a second.
I'm using jquery 2.1.4 btw
Hmm.
All the answers say to create an AngularJS directive.
no clue what that is
I've tried experimenting with them, but I didn't get very far:
Basically, a directive is like a custom HTML element/property.
perhaps it's possible without jquery...
but wait... hmm...
I WANT JQUERY
3
is @DanPantry around?
21:48
Maybe there is an angular solution.
Where are you trying to toggle classes?
I know there is a thing such as ng-class
^^ It allows for the conditional applying of classes.
Are you trying to toggle classes for the cards?
Which class would you like to apply and when?
@SirPython see that ^^
[Cardshifter/HTML-Client] Zomis pushed commit 4b2f8a4e to jquery: added stub code for EntityRemoveMessage
[Cardshifter/HTML-Client] Zomis pushed commit 7d23117a to jquery: trying to manipulate CSS classes with jQuery (doesn't work)
21:56
A separate ID class for each card?
separate ID, not separate class
    function setTargets(targets) {
        $scope.targets = targets.targets;
		$scope.targetsMessage = targets;
		$('.targetable').removeClass('targetable');
		for (var i = 0; i < targets.targets.length; i++) {
			$('#entity-' + targets.targets[i]).addClass('targetable');
		}
    }
I meant here:
id="entity-{{card.id}}"
yes, I know. but the reason is that ^^
Ah, I see.
Try this on each on the card HTML

« first day (385 days earlier)      last day (3476 days later) »