PHP variables....

C++, C#, Java, PHP, ect...
User avatar
Torniquet
Posts: 869
Joined: Sun Aug 02, 2009 6:18 am

Re: PHP variables....

Post by Torniquet »

hallsofvallhalla wrote:i didnt know you were using the tuts as an example. In my example I use it Planetary wars, where everything is instanced. So it doesn't really matter. You could just set a variable at the same time that makes a creature not fightable if it is set to true. Then make your creature query select * where that does not equal that variable. Then set a cron to delete half dead creatures everyday.

Eh so many ways to do it. I like your way it works.
i cant use crons on the server i got atm... and by wht i have read its a linux thing. so im going about it differently, setting advanced times and variables and checking them when pages are loaded. :D prob gunna slow the bastard down a heap though ¬¬

and yus halls i am using the tuts. well as reference anyway :p if i had no use for them i wouldnt have hunted you down now would i :p
New Site Coming Soon! Stay tuned :D
jpoisson
Posts: 245
Joined: Sun Aug 02, 2009 5:12 pm

Re: PHP variables....

Post by jpoisson »

I actually have been working with session more and more and I find that if we use a session array it will ease stress on the server compared to always acting the DB for information.

and I will agree with Halls, you create a column call "fightable" give it a varchar(1) and the only responses you will input are y and n or Y and N for Yes and No. with the default value to Y or y so the monster is fight able once you create him. Then when you initiate a fight you change the value of the "fightable" column to N or n and then only you can fight him. be sure to check in your battle page that if the creatures 'fightable' value is equal to n then you will want to check the creature Id in the player table to see if they are fighting it and if they aren't display them a message about hacking.

If this is a little unclear I am sorry I have this restart thingy popping up all the time and I am really exhausted.
Laguages:
PHP, MYSQL, (X)HTML, HTML5, JQuery, CSS 3.0,
C, C#, C++, Python, Pascal, Perl, Ruby, Turing

Software:
Adobe MC CS4, Visual Studio 2008, Notepad++,
NetBeans IDE, WAMPSERVER

Browsers:
Internet Explorer, Firefox, Opera, Safari, Chrome
(Always have latest patches for browsers.)

Free time:
...
User avatar
Torniquet
Posts: 869
Joined: Sun Aug 02, 2009 6:18 am

Re: PHP variables....

Post by Torniquet »

but you still have to keep updating the db with new creaatures. either through cron or manually.

with the way i am doing it. is that once the creature is set... its set for good. unless of course you want to change the stats lol. but if you write everything to the cookies, then you can manipulate the changing variables that way rather than keep connecting to the db and updating, then removing creatures, then adding more creatures in.
New Site Coming Soon! Stay tuned :D
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: PHP variables....

Post by hallsofvallhalla »

they are both great ways to do it, its all preference.

I dont like having to constantly add new creatures and this will be fixed in the next few videos.

I would not use varchar y and n. Tinyint uses far less memory and you use 1 or 0. 1 = true, 0 = false.
Post Reply

Return to “Coding”