Go Back   RunUO - Ultima Online Emulation > RunUO > RunUO Post Archive > Starbucks @ RunUO.com

Starbucks @ RunUO.com Unmoderated forum for off-topic banter, screen shots, chit-chat and things of this nature. Flames are permitted, and you can pretty much do nearly anything within reason. No advertisements.

 
 
Thread Tools Display Modes
Old 07-01-2008, 12:37 AM   #1 (permalink)
Account Terminated
 
Join Date: Jul 2006
Age: 29
Posts: 240
Default php love'en? I need alittle =P

ok been trying to get my images to do different things.. cant seem to get a string to embed in it properly. can get it to call the names and titles.. but trying to add something like "name: " + $name doesnt work for crap =( so anyone wanna give me a hand that is familiar with php??

Zaphieon is offline  
Old 07-01-2008, 01:01 AM   #2 (permalink)
Forum Expert
 
mordero's Avatar
 
Join Date: Nov 2003
Location: Illinois, USA
Age: 22
Posts: 2,911
Default

Google is your friend.

And so is using the correct forums: Script Languages - RunUO - Ultima Online Emulation
mordero is offline  
Old 07-01-2008, 01:47 AM   #3 (permalink)
Account Terminated
 
Join Date: Jul 2006
Age: 29
Posts: 240
Default

actually thought i posted there. =P if you dont have any help other then "google is your friend" then please stfu lol.. google is always my first resort to 99% of anything.. even looking up a number instead of using the phone book.. google is godsend I swear.. but no frets i am still roaming through countless websites learning yet another scripting language.. but having found the answer yet.. found a ton of other things.
Zaphieon is offline  
Old 07-01-2008, 02:30 AM   #4 (permalink)
Forum Expert
 
mordero's Avatar
 
Join Date: Nov 2003
Location: Illinois, USA
Age: 22
Posts: 2,911
Default

Well if you want help, then you will need to actually describe the problem better than that. And I provided great help:
1. use google
2. use the correct forum
mordero is offline  
Old 07-01-2008, 02:39 AM   #5 (permalink)
Account Terminated
 
J MaNN's Avatar
 
Join Date: Apr 2006
Location: ┬MeDiNa, OhIo┬
Age: 20
Posts: 1,317
Default

Quote:
Originally Posted by Zaphieon View Post
if you dont have any help other then "google is your friend" then please stfu lol..
Probably why no one else has offered any help. I don't think there is any respect for you around here.
J MaNN is offline  
Old 07-01-2008, 02:55 AM   #6 (permalink)
Account Terminated
 
Join Date: Aug 2006
Location: Mexico / California
Age: 100
Posts: 557
Send a message via AIM to Arkad
Default

Zaphieon - realize that asking for help here is like walking into a homeless camp full of drunks and asking for help on your calculus homework.
Arkad is offline  
Old 07-01-2008, 03:20 AM   #7 (permalink)
Master of the Internet
 
bzk90's Avatar
 
Join Date: Jun 2003
Location: Nevada
Age: 18
Posts: 6,630
Send a message via AIM to bzk90 Send a message via MSN to bzk90 Send a message via Yahoo to bzk90
Default

Quote:
Originally Posted by mordero View Post
Well if you want help, then you will need to actually describe the problem better than that. And I provided great help:
1. use google
2. use the correct forum

you should have used google to find the 10+ posts created by the runuo higher ups telling people not to respond to threads with posts like "use google"
__________________
Experience is not what happens to you; it is what you do with what happens to you. - Aldous Huxley

In order to be effective truth must penetrate like an arrow - and that is likely to hurt. - Wei Wu Wei

Let men gain wisdom - or buy a rope - Antisthenes
bzk90 is offline  
Old 07-01-2008, 03:20 AM   #8 (permalink)
Account Terminated
 
Join Date: Jul 2006
Age: 29
Posts: 240
Default

Quote:
Originally Posted by Arkad View Post
Zaphieon - realize that asking for help here is like walking into a homeless camp full of drunks and asking for help on your calculus homework.
LOL.. thats beautifully said.. I didnt mean to post in here.. i meant to hit the programming section.. but oh well. it should turn out to be a beautiful thread lol..


Mordero oh i wasnt arguing bud.. =P i was teasing.. though i meant to post in the other thread.. and i did google already..

what i am trying to do is add text into the image. if you have a tutorial on this be great.. atm the way i am adding the strings its very limited what i can do...
Zaphieon is offline  
Old 07-01-2008, 04:13 AM   #9 (permalink)
Forum Novice
 
anybody's Avatar
 
Join Date: Feb 2008
Location: Wasilla, Alaska
Age: 35
Posts: 127
Default

You might have better luck if you went and got help from a site that deals specifically with php.
__________________
Quote:
Originally Posted by George Carlin
I have a right to my opinion too and my opinion is... You don't have a right to your opinion!
anybody is offline  
Old 07-01-2008, 04:46 AM   #10 (permalink)
Forum Expert
 
Rosetta's Avatar
 
Join Date: May 2007
Location: In the Trees =]
Age: 32
Posts: 982
Send a message via AIM to Rosetta
Default

Quote:
Originally Posted by Arkad View Post
Zaphieon - realize that asking for help here is like walking into a homeless camp full of drunks and asking for help on your calculus homework.
lmao ok that is just funny =]
__________________
Rose: You think you're so impressive. The Doctor: I am so impressive! Rose: You wish.
Rosetta is offline  
Old 07-01-2008, 11:17 AM   #11 (permalink)
Forum Expert
 
mordero's Avatar
 
Join Date: Nov 2003
Location: Illinois, USA
Age: 22
Posts: 2,911
Default

Quote:
Originally Posted by bzk90 View Post
you should have used google to find the 10+ posts created by the runuo higher ups telling people not to respond to threads with posts like "use google"
I didnt just say use google, I said "Google is your friend" and I also pointed out that using the correct forum to ask questions would prolly be a good idea.

Quote:
Originally Posted by Arkad View Post
Zaphieon - realize that asking for help here is like walking into a homeless camp full of drunks and asking for help on your calculus homework.
Calculus is fun
mordero is offline  
Old 07-01-2008, 02:24 PM   #13 (permalink)
Forum Expert
 
Vorspire's Avatar
 
Join Date: Jan 2005
Location: Newcastle, United Kingdom
Age: 21
Posts: 2,298
Send a message via ICQ to Vorspire Send a message via MSN to Vorspire Send a message via Skype™ to Vorspire
Default

You know i already have this working fully, php is a fun and very simple, easy language to learn...

BTW, Zaphieon, you generated image is over 100kb, which is really bad...



To put synamic PHP scriings together, instead of the generic C# '+' char modifyer, use a full-stop '.' char to joion strings.

Code:
$string = 'Name: '. $name;
Any variable encased in double-quotes does not need any special treatment:

Code:
$string = " Name: $name ";
__________________

WWW.RPK-UO.COM - The WoW-UO Cross-Over Shard

Last edited by Vorspire; 07-01-2008 at 02:27 PM.
Vorspire is offline  
Old 07-01-2008, 02:34 PM   #14 (permalink)
Account Terminated
 
Join Date: Jul 2006
Age: 29
Posts: 240
Default

Quote:
Originally Posted by Vorspire View Post
You know i already have this working fully, php is a fun and very simple, easy language to learn...

BTW, Zaphieon, you generated image is over 100kb, which is really bad...



To put synamic PHP scriings together, instead of the generic C# '+' char modifyer, use a full-stop '.' char to joion strings.

Code:
$string = 'Name: '. $name;
Any variable encased in double-quotes does not need any special treatment:

Code:
$string = " Name: $name ";
yes it seems to be very enjoyable so far.. learning all sorts of fun little things.. thanks for the method there.. so simple i overlooked it =( - the size of that image is easily reduced, just playing with it atm.
Zaphieon is offline  
Old 07-01-2008, 02:58 PM   #15 (permalink)
Forum Expert
 
Vorspire's Avatar
 
Join Date: Jan 2005
Location: Newcastle, United Kingdom
Age: 21
Posts: 2,298
Send a message via ICQ to Vorspire Send a message via MSN to Vorspire Send a message via Skype™ to Vorspire
Default

Quote:
Originally Posted by Zaphieon View Post
yes it seems to be very enjoyable so far.. learning all sorts of fun little things.. thanks for the method there.. so simple i overlooked it =( - the size of that image is easily reduced, just playing with it atm.
Yeah, it's a bitch to keep quality and keep the image small in size.. I really recommend working with PNG-only when doing php image generation and rendering :P

PHP is not dissimilar to C# in a lot of ways, but differentiates to C# in the aspect of Object Orientation. PHP is incapable of storing scripts in memory, thus you only get one output per page and without using Sessions, it is nearly impossible to pass references to seperate scripts.

If you write your PHP classes as if you were writing a C# class (same sort of structure), then you'll pick it up easily.

The main differences are, when accessing a class or method (PHP-specific Methods are called Functions)
(if the method exists in the same class as you wish to call it from, you must still use "this" accessor):

Code:
PHP:

$this->Function();

C#:

this.Method();
or when declaring a variable:

Code:
PHP:

var $variable;

C#:

object m_variable;
(Every PHP object is known as a 'var' - similar to JavaScript)

You can, but don't have to do any type-casting with PHP, because the PHP parser is smart enough to know the difference between and integer and a string :P

Anything alse you want to learn, just ask.

-Just out of curiosity, did you pick up my Paperdoll Script from that other thread for your base? If so, i will be able to offer more support on it
__________________

WWW.RPK-UO.COM - The WoW-UO Cross-Over Shard

Last edited by Vorspire; 07-01-2008 at 03:02 PM.
Vorspire is offline  
Old 07-01-2008, 03:45 PM   #16 (permalink)
ConnectUO Creator
 
Jeff's Avatar
 
Join Date: Jan 2004
Age: 28
Posts: 4,891
Default

"name:'.$name
__________________
Jeff Boulanger
ConnectUO - Core Developer

Want to help make ConnectUO better? Click here to submit your ideas/requests
Use your talent to compete against other community members in RunUO hosted coding competitions

If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team.


Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO
Jeff is offline  
Old 07-01-2008, 03:46 PM   #17 (permalink)
Master of the Internet
 
TMSTKSBK's Avatar
 
Join Date: Feb 2004
Location: NC/NC State Univ
Age: 23
Posts: 16,424
Default

"name:'.$name


nooooooooo. Your quotes are fubar'd.
__________________
Goodbye, folks.
TMSTKSBK is offline  
Old 07-01-2008, 03:49 PM   #18 (permalink)
Account Terminated
 
Join Date: Jul 2006
Age: 29
Posts: 240
Default

no i was digging through an old harddrive with my last server on it.. found old from zulu's days.

though i could grab that and play with it as well.. fairly good are reverse engineering scripts.

now about image sizes.. my orginal black image is abotu the same size as yours atm.. and I plan on sizing them both down when i get back to the house. going to attempt to design a few more that if i can figure it out, to switch according to the players status. Choas, Order, PK, AntiPK(( anti pk get auto antipk counts for killing pks with 10 or more murder counts, have there own hue name and so on.)), Nuetral

Last edited by Zaphieon; 07-01-2008 at 04:15 PM.
Zaphieon is offline  
Old 07-01-2008, 05:20 PM   #19 (permalink)
Account Terminated
 
Join Date: Jul 2006
Age: 29
Posts: 240
Default

well I added a bit more to it.. but cant seem to get the info to print correctly.

connects to sql

Code:
$link = sql_connect();
$result = sql_query($link, "SELECT char_name,char_female,char_bodyhue,char_str,char_dex,char_int FROM myrunuo_characters WHERE char_id=$id");
if (!(list($nametitle,$charfemale,$charbodyhue,$cstr,$cdex,$cint) = mysql_fetch_row($result)))
  die();
mysql_free_result($result);
and heres where it prints the text.
Code:
function AddText(&$img, $name, $title)
{
	//$font_size = 56 ;
	$textcolor = imagecolorallocate($img, 255, 255, 255);
	$pos = (int) (55 - (strlen($name)));
	if ($pos < 0)
	  $pos = 0;
  imagestring($img, 1, $pos, 264, $name, $textcolor); //Name
  
	$pos = (int) (55 - (strlen($title)));
	if ($pos < 0)
	  $pos = 0; 
  imagestring($img, .5, $pos, 276, $title, $textcolor); //Title
  

  imagestring($img, .5, 155, 264, 'Str: '.$cstr, $textcolor); // str
  
  imagestring($img, .5, 155, 271, 'Dex: '.$cdex, $textcolor); // dex

  imagestring($img, .5, 155, 278, 'Int: '.$cint, $textcolor); // int

}
but its not printing the values for str, dex, int.

Zaphieon is offline  
Old 07-01-2008, 05:42 PM   #20 (permalink)
Forum Expert
 
Vorspire's Avatar
 
Join Date: Jan 2005
Location: Newcastle, United Kingdom
Age: 21
Posts: 2,298
Send a message via ICQ to Vorspire Send a message via MSN to Vorspire Send a message via Skype™ to Vorspire
Default

TMS is right, if you're going to open a string variable with double-quotes, you have to close it with double quotes, same for single quote. double-quoting strings make the string variable more solid, all characters are literals and $var values are parsed without quotations
__________________

WWW.RPK-UO.COM - The WoW-UO Cross-Over Shard

Last edited by Vorspire; 07-01-2008 at 05:44 PM.
Vorspire is offline  
Old 07-01-2008, 08:06 PM   #21 (permalink)
Forum Expert
 
PerfectWing's Avatar
 
Join Date: Oct 2002
Location: USA, Ga.
Age: 24
Posts: 1,205
Send a message via ICQ to PerfectWing Send a message via AIM to PerfectWing Send a message via MSN to PerfectWing Send a message via Yahoo to PerfectWing
Default

It's been a very, very long time since I've dealt with any PHP and I was certainly never exceptional at it. But, some points I picked out that may or may not be correct and could be checked again would be that:

I noticed you don't pass the variables ($cstr, $cdex, $cint) into the function that handles the paperdoll text printing. (This might not be necessary)

I noticed you don't access them through the list you put them in such as maybe ($listname[$cstr].. so forth and so on) and I was wondering if maybe that's the cause.

Just a couple shots in the dark.
PerfectWing is offline  
Old 07-03-2008, 09:03 AM   #22 (permalink)
Forum Novice
 
Join Date: Dec 2005
Posts: 608
Default

You probably don't have globalvars on which is a good thing.

In your function you pass the image the name and the title, but inside the function there is no variable defined with the names $cstr, $cdex or $cint, thus these variables are null, and a null string is nothing.

Also single quotes aren't made with single quotes (') but with double quotes (")

Code:
  imagestring($img, .5, 155, 264, 'Str: '.$cstr, $textcolor); // str
should be

Code:
  imagestring($img, .5, 155, 264, "Str: ".$cstr, $textcolor); // str
b0b01 is offline  
Old 07-03-2008, 01:24 PM   #23 (permalink)
Account Terminated
 
Join Date: Jul 2006
Age: 29
Posts: 240
Default

ahh figured it out.. overlooked a small addtext insert higher in the code.
Zaphieon is offline  
Old 07-03-2008, 05:42 PM   #24 (permalink)
Account Terminated
 
Join Date: Aug 2006
Location: Mexico / California
Age: 100
Posts: 557
Send a message via AIM to Arkad
Default

Thats sweet how do you do them magic tricks?
Arkad is offline  
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On