legrolls Posted June 8, 2009 Posted June 8, 2009 For my new futuristic game, I want you to be able to choose human or alien instead of male or female. How would I do this? Quote
Miniman Posted June 8, 2009 Posted June 8, 2009 Re: Something other than male/female? Anywhere is has 'Male' or 'Female' change it to what you want. You could still have Male and Female stored in the users table, because users aren't going to see that :-) So; Male could become Human And Female could become Alien (not suggesting anything towards females here :lol:) Or visa versa Just find the file it's in and change the name. Ofcourse don't change It in the $db->query unless you have added Human and Alien into the DB If that makes sense.... Quote
AbsentCrisis Posted June 8, 2009 Posted June 8, 2009 Re: Something other than male/female? Couldnt you do something in a file mccodes uses on everypage load replacing the text "male" & "female" with your chosen options. str_replace or something not sure :S Quote
Miniman Posted June 8, 2009 Posted June 8, 2009 Re: Something other than male/female? You could use something like this...I guess? function doesntmatterwhatitscalled($blah) { return (str_replace("Male", "Human", $blah)); } ob_start("doesntmatterwhatitscalled"); But if two people were mailing each other and someone says "So are you Male or Female?" The other person would get "So are you Human or Female?" lol Quote
Haunted Dawg Posted June 8, 2009 Posted June 8, 2009 Re: Something other than male/female? function buffer_output($buffer) { return str_ireplace(array('male','female'), array('human','alien'), $buffer); } ob_start('buffer_output'); Edited: Error Quote
Miniman Posted June 8, 2009 Posted June 8, 2009 Re: Something other than male/female? function buffer_output($buffer) { return str_ireplace(array('male','female'), array('human','alien', $buffer); } ob_start('buffer_output'); Or that, I was waiting to get asked how to add both, then I'd use an array :-P. This way is better, Go with this. :lol: Quote
Tonka Posted June 8, 2009 Posted June 8, 2009 Re: Something other than male/female? instead of writing a stupid function for it, just modify it in the database. leave the column called gender and than replace male and female with human and alien and than edit the preferences page to reflect the change. Quote
Lithium Posted June 8, 2009 Posted June 8, 2009 Re: Something other than male/female? instead of writing a stupid function for it, just modify it in the database. leave the column called gender and than replace male and female with human and alien and than edit the preferences page to reflect the change. Writing a stupid function is the best way if you still want a compatible db to use other mods, otherwise you would need to keep recoding every single change you apply on a game! Quote
Tonka Posted June 8, 2009 Posted June 8, 2009 Re: Something other than male/female? instead of writing a stupid function for it, just modify it in the database. leave the column called gender and than replace male and female with human and alien and than edit the preferences page to reflect the change. Writing a stupid function is the best way if you still want a compatible db to use other mods, otherwise you would need to keep recoding every single change you apply on a game! I'm all for using function to make tedious tasks easier, but when they're not needed there's no point. Even if a function is used a script modification will be required to incorporate the function into it a database modification is the easiest way in my mind as modification is required either way. Quote
Haunted Dawg Posted June 8, 2009 Posted June 8, 2009 Re: Something other than male/female? Editing the Database.. Sure, you care to provide like 15 file's recoded to fit it? Quote
Tonka Posted June 8, 2009 Posted June 8, 2009 Re: Something other than male/female? yea, going through and replacing $ir['male']/$r['male'] and $ir['female']/$r['female'] to $ir['human']/$r['human'] and $ir['alien']/$r['alien'] isn't really that hard. Quote
Haunted Dawg Posted June 8, 2009 Posted June 8, 2009 Re: Something other than male/female? lol.. Your even wrong there.. It's $ir['gender']/$r['gender']. Quote
Danny696 Posted June 8, 2009 Posted June 8, 2009 Re: Something other than male/female? if you havent installed it yet look in dbdata.sql i think and on line 980 it says `gender` enum('Male','Female') NOT NULL default 'Male', you could change that to it says `type` enum('Human','Alien') NOT NULL default 'Human', then instead of gender you have type Quote
Miniman Posted June 8, 2009 Posted June 8, 2009 Re: Something other than male/female? if you havent installed it yet look in dbdata.sql i think and on line 980 it says `gender` enum('Male','Female') NOT NULL default 'Male', you could change that to it says `type` enum('Human','Alien') NOT NULL default 'Human', then instead of gender you have type You still need to edit other files "Gender : Alien" Doesn't really work. Quote
legrolls Posted June 8, 2009 Author Posted June 8, 2009 Re: Something other than male/female? Any other help? I haven't made the game yet, and this is very important. Quote
Miniman Posted June 8, 2009 Posted June 8, 2009 Re: Something other than male/female? Any other help? I haven't made the game yet, and this is very important. I'd go with Haunted's function, add it to globals :) Quote
legrolls Posted June 8, 2009 Author Posted June 8, 2009 Re: Something other than male/female? Haunted Dawg's doesn't work, he states that himself... Quote
Haunted Dawg Posted June 8, 2009 Posted June 8, 2009 Re: Something other than male/female? It say's: Edited: Error meaning i fixed an error, it should work -_- Quote
legrolls Posted June 8, 2009 Author Posted June 8, 2009 Re: Something other than male/female? When I put it in globals.php, it gave me an error. Here is the globals.php <?php /*--------------------------------- -- MCCodes 2.0 -- By Dabomstew ---------------------------------*/ session_start(); ob_start(); if(get_magic_quotes_gpc() == 0) { foreach($_POST as $k => $v) { $_POST[$k]=addslashes($v); } foreach($_GET as $k => $v) { $_GET[$k]=addslashes($v); } } require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; include "config.php"; global $_CONFIG; define("MONO_ON", 1); require "class/class_db_{$_CONFIG['driver']}.php"; $db=new database; $db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']); $db->connect(); $c=$db->connection_id; $set=array(); $settq=$db->query("SELECT * FROM settings"); while($r=$db->fetch_row($settq)) { $set[$r['conf_name']]=$r['conf_value']; } $domain=$_SERVER['HTTP_HOST']; global $jobquery, $housequery; if($jobquery) { $is=$db->query("SELECT u.*,us.*,j.*,jr.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN jobs j ON j.jID=u.job LEFT JOIN jobranks jr ON jr.jrID=u.jobrank WHERE u.userid=$userid"); } else if($housequery) { $is=$db->query("SELECT u.*,us.*,h.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN houses h ON h.hWILL=u.maxwill WHERE u.userid=$userid"); } else { $is=$db->query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid"); } $ir=$db->fetch_row($is); if($ir['force_logout']) { $db->query("UPDATE users SET force_logout=0 WHERE userid=$userid"); session_unset(); session_destroy(); header("Location: login.php"); exit; } global $macropage; if($macropage && !$ir['verified'] && $set['validate_on']==1) { header("Location: macro1.php?refer=$macropage"); exit; } check_level(); $h = new headers; $h->startheaders(); $fm=money_formatter($ir['money']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); global $atkpage; if($atkpage) { $h->userdata($ir,$lv,$fm,$cm,0); } else { $h->userdata($ir,$lv,$fm,$cm); } global $menuhide; if(!$menuhide) { $h->menuarea(); } ?> Quote
legrolls Posted June 8, 2009 Author Posted June 8, 2009 Re: Something other than male/female? FINISHED. THANK'S EVERYONE! (It was none of your suggestions, though...thanks anyway!) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.