A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 27 of 27

Thread: is my PC haunted ?

  1. #21
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Moot, Cap.

    It is all done using http://smartfoxserver.com/ engine, which utilises java code that you install on your own computer when you use the smartfox server stuff. I believe you are using the SFS Pro Cap!

    I know some of the smartfox stuff as I helped Cap with his chat room server, smartfox can be a pain in the ^&^*%% just getting it to work in the first place and I don't think you will want to install it Moot unless you are going to use it.

    Theres no real way to understand the output or input without seeing it happen in real time on your own computer

  2. #22
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    389
    Ouch!

    you got me there. The _server.sendResponseCode could be this:

    Code:
    function handleMove(prms, u)
    {
    	var px = prms.x
    	var py = prms.y
    	var value = prms.value
    				
    	var obj = {}
    	obj._cmd = "move"
    	obj.x = px
    	obj.y = py
    	obj.t = whoseTurn + 1
    	trace("whoseTurn = "+whoseTurn);
    	trace("player index = "+u.getPlayerIndex());
    	obj.value = value
    				
    	_server.sendResponse(obj, currentRoomId, null, users)
    }
    but I do not know what the backend code means. Not even too sure about the API...

    Is the backend Java and the API the classes for flash to interpret it?

    Excuse my ignorance. I will give up posting if I'm way too far behind when I can't understand something that should be basic. I thought once I had the extension and the client in flash set, I'd be able to go on just trying to apply common sense to the coding in the extension and the client's timelines.

    I'm only working on this as a hobby and don't want to take you people's time, but, without meaning to criticize smartfox, they have no examples for over 2 players and I don't know where else to ask. They have helped me enough as well.

    I'll keep working at my own pace and maybe I will attach everything when I'm able to make a skeleton version of my fla excluding the images so I can fit it here.

  3. #23
    Senior Member
    Join Date
    Nov 2001
    Posts
    1,145
    That's what's hard in forums like these, you don't know what people know.

    I know youre on smartfox from a previous post and what smartfox is. I was just saying I can't help you with smartfox because I don't have the code (or the framework installed) and I can't see the error. When you ask about an error with your actionscript, you show me the code and I can try it myself if I need to. I have no idea how to debug smartfox. I can help with regular php, .net, and stuff.

    For websites and applications (internet applications), you can call the server and its software (php, net, databases, java), the backend, the files you download as a user (what you see and use) (swf, html, javascript, css) the frontend.

    API is how you use somebody else's code. _server.sendResponse() is in smartfox's API - it's a function you use to control their code.

  4. #24
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    389
    Good day,

    I see. Or I see quite better now. Thanks for the explanation.

    Som isn't this function where the response lies?

    Code:
    function handleMove(prms, u)
    {
    	var px = prms.x
    	var py = prms.y
    	var value = prms.value
    				
    	var obj = {}
    	obj._cmd = "move"
    	obj.x = px
    	obj.y = py
    	obj.t = whoseTurn + 1
    	obj.value = value
    				
    	_server.sendResponse(obj, currentRoomId, null, users)
    }
    the px prms and the py are for the cards new location (from the hand to the table), the value keeps the cards' values. These two parameters get back to my client and work (excuse me but I can't find a synonym for that) and then the obj.t should be the turn handled by the server. I'm receiving the turn shift because my client traces whoseTurn = 2 but I'm either doing something wrong in the setTurn function in my client or I really don't have an idea... below is the setTurn function and it works when I start off the game setting a trump that's why I can't imagine what is happening.

    Code:
    function setTurn() {
    	if (_global.myID == whoseTurn) {
    		trace("whoseTurnClient = "+_global.whoseTurn);
    		_root.turn_txt.text = "It's "+this["player"+whoseTurn+"Name"]+" turn";
    	}
    	if (iAmSpectator) {
    		_root.turn_txt.text = "It's "+this["player"+whoseTurn+"Name"]+" turn";
    	} else {
    		_root.turn_txt.text = "It's "+this["player"+whoseTurn+"Name"]+" turn";
    	}
    }

  5. #25
    Senior Member
    Join Date
    Nov 2001
    Posts
    1,145
    I would create a simple test file to figure out how the communication between the swf and smartfox works. Just pass a variable back and fourth so you know it works and know how.

    _server.sendResponse(obj, currentRoomId, null, users) - is a custom function SmartFox created for you to use. It's the one that sends obj to your swf.

    The game is controlled by one of the swfs, the dealer, who passes cards to other swfs?

    You have to stop using bad variable names. You are using "x" as a variable name. Think about it. That's the position of your object, it's reserved, it's not a variable name.

    This is updated using your own variable names in place of the reserved words:
    Code:
    //  create one object and update it?  put it here
    //  var obj = {}
    
    
    function handleStart(prms, u)
    {
        var obj = {}  //  new object
        obj._cmd = "startHand"
        obj.tr = prms.tr
        obj.t = whoseTurn + 1
                    
        _server.sendResponse(obj, currentRoomId, null, users)
    }
    
    
    
    function handleMove(prms, u)
    {
        var px = prms.px
        var py = prms.px
        var value = prms.cardValue
                    
        var obj = {} //  new object
        obj._cmd = "move"
        obj.px = px
        obj.px = py
        obj.whoseTurn = whoseTurn + 1
        obj.cardValue = value
                    
        _server.sendResponse(obj, currentRoomId, null, users)
    }

  6. #26
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    You have a long way to go yet Cap, this is probably the beginning of many more problems, I can get it to work with 2 players too although it gives errors, this image might help you along a little, you might also want to change *res.n = u.getName()* to *res.n = users.getName()*Attachment 74807 I have no idea hot to play the game though, perhaps some instructions might help

    You were getting these errors in the cmd window too
    Code:
    [ WARNING] > Error in extension [ botifarra.as ]: TypeError: can not call method "getName" of undefined (botifarra.as~1654) Internal:77 -- Line number: 77 in file: botifarra.as
    Last edited by fruitbeard; 03-31-2014 at 01:02 PM.

  7. #27
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    389
    Good day,

    thanks for the replies. Funny because I thought I had passed you the updated version FruitBeard. I did get past that and I have all my players in the right place and with the right names. That message, I asked about at smartfox forums and I was told not to worry and keep testing. It's complicated, I know no one said this would be easy, but it is especially when you don't know where to reach for help. The administrator panel should also trace the players' Ids but even in their examples it doesn't.

    Thanks for taking a look at it though. I will get back to it in time (I hope as2 still exists by then ) I thought using reserved words would not be advisable, thanks...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center