Page 2 of 2
Re: PHP variables....
Posted: Thu Aug 13, 2009 10:53 pm
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.

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
Re: PHP variables....
Posted: Fri Aug 14, 2009 7:39 am
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.
Re: PHP variables....
Posted: Fri Aug 14, 2009 12:38 pm
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.
Re: PHP variables....
Posted: Fri Aug 14, 2009 1:47 pm
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.