Jump to content
MakeWebGames

Player Classes


Recommended Posts

  • Replies 66
  • Created
  • Last Reply

Top Posters In This Topic

Because " is not a valid delimiter i this context.

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Would be the obvious solution after reading the heredoc reference in detail.

Good lookin out Alan. I really can't stand heredoc and nowdock so anytime I see them I remove them, I'm sure somewhere they serve a good purpose but just my preference and style to end my strings etc one by one, plus it makes things easier to read with the syntax highlighting of a text editor

Link to comment
Share on other sites

If you consider the different forms of string handling within PHP, it should become pretty apparent that each serves a specific purpose; I'm a fan of using heredoc if I'm forced to use raw SQL queries rather than simple calls to stored-procedures as it makes copying and pasting the query into (for example) MySQL-Workbench very easy. There is also a strong case for using heredoc when outputting a mix of HTML and JavaScript however, I veer towards template solutions wherever possible saving me from this otherwise onerous task.

Consider the following:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

vs

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Ask yourself which is easier to read, and in 6-weeks, 6-months, or 6-years time easier to maintain?

Link to comment
Share on other sites

well, when you put it like that for sure the top snippet is by far easier but in all honesty I wouldn't have done it that way either :p on another note I don't do any sort of javascript so ill chalk it up as a +1 for you. and like I said I found in my ventures no real use for it but that neither here nor there and thanks for the lesson ill try to remember it

Also original post is updated to add the userstats in

Edited by KyleMassacre
Link to comment
Share on other sites

  • 2 weeks later...
  • 3 months later...
  • 4 months later...

basically i dont know were to add it and if i do add it in register ie this

print "

<tr>

<td>Player Class</td>

<td colspan='2'>".class_dropdown(NULL, "classID")."

</td>

</tr>";

I it dont work i get this error

Fatal error: Call to undefined function class_dropdown() in /home/mafiali2/public_html/register.php on line 339

and on that line is this <td colspan='2'>".class_dropdown(NULL, "classID")."

Link to comment
Share on other sites

basically i dont know were to add it and if i do add it in register ie this

print "

<tr>

<td>Player Class</td>

<td colspan='2'>".class_dropdown(NULL, "classID")."

</td>

</tr>";

I it dont work i get this error

Fatal error: Call to undefined function class_dropdown() in /home/mafiali2/public_html/register.php on line 339

and on that line is this <td colspan='2'>".class_dropdown(NULL, "classID")."

Ahh you add your tr etc after the last tr in register script mainly below the email section also you are getting an error because you haven't declared class_dropdown() as a function meaning you must add

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Somewhere if im not mistaken correct me if i am.

Link to comment
Share on other sites

Ahh you add your tr etc after the last tr in register script mainly below the email section also you are getting an error because you haven't declared class_dropdown() as a function meaning you must add

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Somewhere if im not mistaken correct me if i am.

Your just calling the function again? Meaning he will get another error for undefined function. You need to DEFINE the function, I'm guessing your not including a file as it can't locate the function.

Link to comment
Share on other sites

sorry i do not understand that ?/ could u make it clearer please?...

Ahh i see now it already asks you to include some functions in your global_funcs file meaning you probably haven't included the file to your register.php

To fix do as follows below

Add this to global_funcs

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Then in your register.php add

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Link to comment
Share on other sites

Ahh i see now it already asks you to include some functions in your global_funcs file meaning you probably haven't included the file to your register.php

To fix do as follows below

Add this to global_funcs

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Then in your register.php add

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

If your game is in sub directory this won't work

Link to comment
Share on other sites

If you added the part to global funcs like I said in the original post everything should work out fine. In the event that you are getting an error for a function that doesn't exists open up your register and make sure you included global funcs in your page. If it is alread included then you didn't add the part for the drop down in your global funcs file.

Link to comment
Share on other sites

this is staff_classes.php?

ok so i fixed it but when i wanted to create a class i kept getting this Whats the point of having 2 classes with the same name? > Goto Main

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Edited by KyleMassacre
Added code instead of quote tags
Link to comment
Share on other sites

  • 3 months later...
  • 3 months later...

Just added this to my game. The staff file had few minor errors. Wouldn't even say errors.

Thanks for this!

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

As you can see

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Link to comment
Share on other sites

So, I was wondering if anyone would like an expansion of this, like more features to player classes. I can do items, properties, and even gangs.

Kyle I would love something like this. What I'm looking for tho is player advancement. If they reach so many goals they advance to the next lvl

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...