rejetto forum

Trying to learn how to code server side with hfs macros

0 Members and 1 Guest are viewing this topic.

Offline fasi123

  • Occasional poster
  • *
    • Posts: 4
    • View Profile
Hello, I am new to hfs and server side programming. I am very proficient in html, css, javascript, jquery, etc. Anyways I am trying to learn how to program server side with the hfs macros but I cant really find any tutorials and its giving me headaches trying to grasp the hfs documentation. Could anybody show me how to code an online 3d fps with hfs macros? Just Kidding, but I do want at least a direction to go  to learn the macro server side programming so I can make a simple text based online game. Thanks!


Offline fasi123

  • Occasional poster
  • *
    • Posts: 4
    • View Profile
Pretty much I was wondering where I can find a tutorial or how I can learn to code server side with the hfs macros. For game development purposes.



Offline fasi123

  • Occasional poster
  • *
    • Posts: 4
    • View Profile
I had already looked at those wiki pages and Ive also downloaded the private chat messenger (the one that was a few posts before this one http://www.rejetto.com/forum/html-templates/private-messenger-chat/) to look at the coding, so I have a vague grasp of how it works but Im still not very clear on how to do server side scripting with it. I was looking more for a tutorial or a useful forum post, something that would clearly explain HOW to code with macros.


Offline fasi123

  • Occasional poster
  • *
    • Posts: 4
    • View Profile
Or maybe someone could give me a quick brief example on how to macro program, like say I had a simple html5 canvas game where you move a circle around. Two people are playing on different computers. The position of the player's circle is located with variables that contain an x an y coordinate, we can call these variables, xPos and yPos. The players press the arrow keys to call a function that changes the xPos and yPos variables, thus moving the circle. How would I use the macros to update the xPos and yPos variables so that when the guy on one of the computers is moving his circle, the guy on the other computer can see the other guy's circle moving? Thanx!


Offline bmartino1

  • Tireless poster
  • ****
    • Posts: 910
  • I'm only trying to help i mean no offense.
    • View Profile
    • My HFS Google Drive Shared Link
*I'm not an HFS Macor templte, the RARW in the templates would be a beter place to post and get inof form...

I think your better off using jquery on html and share the html on HFS server

https://msdn.microsoft.com/en-us/library/hh404083.aspx
------------------
Haven't tried/tested, but
using something like this and a visual Basic progam side layout:

http://www.rejetto.com/wiki/index.php?title=HFS:_scripting_commands

pos | A | B
expands to the position of A in B. Zero if not found.
Optional parameter from will start searching from specified position.
Optional parameter case will decide case sensitivity. Default is: insensitive.
Example pos|the|i'm the alpha and the omega|from=14|case=1 expands to 19

if A is X####
then (code to move spear...)
IB is y ####
then (code to move spear)

HFS Macor edit:
so in the different template under the settings:
pos | A | B

woudl be
pos | 5 | 5
then (code to move spear...)

somethign along thoses line...
--------

http://www.rejetto.com/wiki/index.php?title=HFS:_Template

i would recomend reviewing HFS defautl HTML Template and then a RARW Template sucha as live 3.0 tpl ( https://drive.google.com/open?id=0B9u5dgydfOEuV3Q4WnZDbkxUTlk&authuser=0 )


hfs > Menu >expert Mode
Menu > HTML template > edit
(or press F6) gice you this:

which is what is displayed and runs HFS...
------------------------
se attachment
--------
« Last Edit: May 14, 2015, 01:45:51 AM by bmartino1 »
Files I have snagged and share can be found on my google drive:

https://drive.google.com/drive/folders/1qb4INX2pzsjmMT06YEIQk9Nv5jMu33tC?usp=sharing


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
hi fasi, i'm sorry for the scarce documentation.
thinking of the case you described i would first decide how to store those variables.
You could have them centralized on the server, or just use the server as a communication proxy between the clients (without storing).
Of course if you were truly into gaming you should consider something different than HFS (node.js with websockets?) but let's stick to your problem.
In the former case you could use AJAX to comunicate with the server. AJAX is already used by the default template to offer several features that are actually coded into the template, like the creation of folders. Check the "ajax" function for details. It uses URl parameters to execute code inside [ajax.SOMETHING] sections.
So, instead of creating a folder you want to just store a variable. Good: you can use {.set.} for that.
By default variables are bound to the single HTTP request, you need to overcome this limit. One easy way is by using global variables.
Apparently i never included in the wiki how to treat global variables. Just prefix the name with #.
The other client can just use again ajax to read that variable.