SphereCommunity
[UPDATED]Paperdoll & Web - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Submissions (/Forum-Script-Submissions)
+--- Thread: [UPDATED]Paperdoll & Web (/Thread-UPDATED-Paperdoll-Web)

Pages: 1 2 3 4 5 6 7 8


[UPDATED]Paperdoll & Web - Avatar - 12-17-2013 09:22 PM

Quote:MyRunUo Php Script -- Sphere Server Entegration -- Rescripted by Avatar

Link for Php Script ==> http://crowskingdom.bizhat.com/MyRunUO-PHP-1.01/
Mysql (Sql) file is on web page i linked.

Example : www.tns.gen.tr/Player_Database/player.php?id=41014

System operation analogy was taken from RunUo C# script and adjusted for SphereServer

Requirements : Mysql Server, Apache Server - Php or Remote Connection ( whatever you wish )
Fundamentals for developing the content : Php Knowledge, Mysql Knowledge

Just change the myrunuo.inc.php files according to your information such as db username, password, server or so.
Also, it is important that you should create uofiles folder and put required mul files in it like the following ;

http://tns.gen.tr/Player_Database/uofiles/

This is not a full functioning script just a simple example of how to create Paperdoll on Web Page.

You can adjust it in several ways like player's statistics, online player, events that you created , etc.

I put one of the example of paperdoll that is functioning in my shard. You can see there.

Mainly items id is operated in php script according to decimal value. Therefore you should change id value to decimal.

Like for 0x23443 , make it in script like <eval <0x23443>>. Actually there is no "X" in our sphereserver. For colors, change them decimal too. Like 0234

==> <eval <0234>>, so and so forth..
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
PHP Code:
[function f_set_mysphere_web// You can put it on login or operate it with timer on item , whatever you like.

serv.MySqlDatabase=mysphere // I prefer to use my data seperately since sometimes is diffucult to maintain all of them in same database.Yet, you can neglect this part or change accordingly.

db.connect
db
.execute delete from myrunuo_characters where char_id='<eval <uid>>' // Each time players want to see their paperdoll, data belong to player should be removed and replaced by the new one.

// Instead of deleting you can also update the content belong to uid like db.query update to related char_str,dex,guild so and so forth. But i would say that it is not convenient.

db.query insert into myrunuo_characters (char_idchar_namechar_strchar_dexchar_intchar_femalechar_countschar_guildchar_guildtitlechar_nototitlechar_bodyhuechar_publicVALUES ('<eval <uid>>''<addslashes <name>>''<str>''<dex>''<int>''<sex>'null'<guild>'null'<title>''<eval <color>>'null// Character Informations, you can adjust if there is missing part.


db.execute delete from myrunuo_characters_layers where char_id='<eval <uid>>' // Removing layers to replace again in order not to duplicate.

// Inserting data of layers from <src>
for x 1 24
    
if <findlayer.<dlocal.x>>
        
ref1 = <findlayer.<dlocal.x>.uid>
        
db.query insert into myrunuo_characters_layers (char_idlayer_iditem_iditem_hueVALUES ('<eval <ref1.cont.uid>>','<dlocal.x>','<eval <ref1.id>>','<eval <ref1.color>>'//
    
endif
endfor
// Character skills
for x 1 49
db
.query insert into myrunuo_characters_skills (char_idskill_idskill_valueVALUES ('<eval <uid>>','<dlocal.x>','<<def.player_skill_<dlocal.x>>')
endfor

db.close
serv
.MySqlDatabase=sphere // Changing default mysql database set in sphere.ini in order not to cause any problems. 

PHP Code:
//// DEFNAME //
[defname player_skilldown]
player_skill_1 Alchemy
player_skill_2 Anatomy
player_skill_3 AnimalLore
player_skill_4 Taming
player_skill_5 Archery
player_skill_6 ArmsLore
player_skill_7 Begging
player_skill_8 Blacksmithing
player_skill_9 Bowcraft
player_skill_10 Camping
player_skill_11 Carpentry
player_skill_12 Cartography
player_skill_13 Cooking
player_skill_14 DetectingHidden
player_skill_15 Enticement
player_skill_16 EvaluatingIntel
player_skill_17 Fencing
player_skill_18 Fishing
player_skill_19 Forensics
player_skill_20 Healing
player_skill_21 Herding
player_skill_22 Hiding
player_skill_23 Inscription
player_skill_24 ItemId
player_skill_25 Lockpicking
player_skill_26 Lumberjacking
player_skill_27 MaceFighting
player_skill_28 Magery
player_skill_29 Meditation
player_skill_30 Mining
player_skill_31 Musicianship
player_skill_32 Parrying
player_skill_33 Peacemaking
player_skill_34 Poisoning
player_skill_35 Provocation
player_skill_36 RemoveTrap
player_skill_37 MagicResistance
player_skill_38 Snooping
player_skill_39 SpiritSpeak
player_skill_40 Stealing
player_skill_41 Stealth
player_skill_42 Swordsmanship
player_skill_43 Tactics
player_skill_44 Tailoring
player_skill_45 TasteId
player_skill_46 Tinkering
player_skill_47 Tracking
player_skill_48 Veterinary
player_skill_49 Wrestling 
Instead of defnames, As simple , You can use <SERV.SKILL.<dlocal._for>.KEY> where <dlocal._for> is the loop id. Using defnames seems not practical indeed.

/// Adding Slash to String, Not to cause any syntax problem in mysql database. This might be a little advance for those who are not familiar with MYSQL issues.

PHP Code:
[function addslashes]
local.str=<asc <args>>
local.string=s
for i 0 strlen(<local.str>)
    
local.check=<strarg <local.str>>
    
local.last=<local.check>
    if (<
local.check> == 00)
        return <
strsub 1 <eval strlen(<local.string>)-2> <local.string>>
    endif
    if (<
local.check>=<asc \>)
        
local.last=<asc \>
        
local.string <strsub 0 <eval strlen(<local.string>)-1> <local.string>>\\s
    elif 
(<local.check>=<asc '>)
        local.string <strsub 0 <eval strlen(<local.string>)-1> <local.string>>\'s
    else
        local.string <strsub 0 <eval strlen(<local.string>)-1> <local.string>><chr <local.check>>s
    endif
    local.str=<streat <local.str>>
endfor
return <strsub 1 <eval strlen(<local.string>)-2> <local.string>> 



RE: Paperdoll & Web - Crusader - 12-17-2013 09:42 PM

Very cool, thx!


RE: Paperdoll & Web - Avatar - 12-17-2013 09:54 PM

You're welcome. I updaded the content. There was missing part i forgot to mention about Smile


RE: Paperdoll & Web - admin_teclis - 12-20-2013 04:20 AM

Hi Avatar,
i have a problem with your script. My paperdoll.scp:

[function f_set_mysphere_web] // You can put it on login or operate it with timer on item , whatever you like.

serv.MySqlDatabase=sphere // I prefer to use my data seperately since sometimes is diffucult to maintain all of them in same database.Yet, you can neglect this part or change accordingly.

db.connect
db.execute delete from myrunuo_characters where char_id='<eval <uid>>' // Each time players want to see their paperdoll, data belong to player should be removed and replaced by the new one.

db.query insert into myrunuo_characters (char_id, char_name, char_str, char_dex, char_int, char_female, char_counts, char_guild, char_guildtitle, char_nototitle, char_bodyhue, char_public) VALUES ('<eval <uid>>', '<addslashes <name>>', '<str>', '<dex>', '<int>', '<sex>', null, '<guild>', null, '<title>', '<eval <color>>', null) // Character Informations, you can adjust if there is missing part.


db.execute delete from myrunuo_characters_layers where char_id='<eval <uid>>' // Removing layers to replace again in order not to duplicate.

// Inserting data of layers from <src>
for x 1 24
if <findlayer.<dlocal.x>>
ref1 = <findlayer.<dlocal.x>.uid>
db.query insert into myrunuo_characters_layers (char_id, layer_id, item_id, item_hue) VALUES ('<eval <ref1.cont.uid>>','<dlocal.x>','<eval <ref1.id>>','<eval <ref1.color>>') //
endif
endfor
// Character skills
for x 1 49
db.query insert into myrunuo_characters_skills (char_id, skill_id, skill_value) VALUES ('<eval <uid>>','<dlocal.x>','<<def.player_skill_<dlocal.x>>')
endfor

db.close
serv.MySqlDatabase=sphere // Changing default mysql database set in sphere.ini in order not to cause any problems.

//// DEFNAME //
[defname player_skilldown]
player_skill_1 Alchemy
player_skill_2 Anatomy
player_skill_3 AnimalLore
player_skill_4 Taming
player_skill_5 Archery
player_skill_6 ArmsLore
player_skill_7 Begging
player_skill_8 Blacksmithing
player_skill_9 Bowcraft
player_skill_10 Camping
player_skill_11 Carpentry
player_skill_12 Cartography
player_skill_13 Cooking
player_skill_14 DetectingHidden
player_skill_15 Enticement
player_skill_16 EvaluatingIntel
player_skill_17 Fencing
player_skill_18 Fishing
player_skill_19 Forensics
player_skill_20 Healing
player_skill_21 Herding
player_skill_22 Hiding
player_skill_23 Inscription
player_skill_24 ItemId
player_skill_25 Lockpicking
player_skill_26 Lumberjacking
player_skill_27 MaceFighting
player_skill_28 Magery
player_skill_29 Meditation
player_skill_30 Mining
player_skill_31 Musicianship
player_skill_32 Parrying
player_skill_33 Peacemaking
player_skill_34 Poisoning
player_skill_35 Provocation
player_skill_36 RemoveTrap
player_skill_37 MagicResistance
player_skill_38 Snooping
player_skill_39 SpiritSpeak
player_skill_40 Stealing
player_skill_41 Stealth
player_skill_42 Swordsmanship
player_skill_43 Tactics
player_skill_44 Tailoring
player_skill_45 TasteId
player_skill_46 Tinkering
player_skill_47 Tracking
player_skill_48 Veterinary
player_skill_49 Wrestling

And in the sphere console error:

19:13:ERROR:(paperdoll.scp,6)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,8)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,8)Can't resolve <addslashes AoA>
19:13:ERROR:(paperdoll.scp,8)Can't resolve <str>
19:13:ERROR:(paperdoll.scp,8)Can't resolve <dex>
19:13:ERROR:(paperdoll.scp,8)Can't resolve <int>
19:13:ERROR:(paperdoll.scp,8)Can't resolve <sex>
19:13:ERROR:(paperdoll.scp,8)Can't resolve <guild>
19:13:ERROR:(paperdoll.scp,8)Can't resolve <color>
19:13:ERROR:(paperdoll.scp,11)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,15)Can't resolve <findlayer.1>
19:13:ERROR:(paperdoll.scp,15)Can't resolve <findlayer.2>
19:13:ERROR:(paperdoll.scp,15)Can't resolve <findlayer.3>
19:13:ERROR:(paperdoll.scp,15)Can't resolve <findlayer.4>
19:13:ERROR:(paperdoll.scp,15)Can't resolve <findlayer.5>
19:13:ERROR:(paperdoll.scp,15)Can't resolve <findlayer.6>
19:13:ERROR:(paperdoll.scp,15)Can't resolve <findlayer.7>
19:13:ERROR:(paperdoll.scp,15)Can't resolve <findlayer.8>
19:13:ERROR:(paperdoll.scp,15)Can't resolve <findlayer.9>
19:13:ERROR:(paperdoll.scp,15)Can't resolve <findlayer.10>
19:13:ERROR:(paperdoll.scp,15)Can't resolve <findlayer.11>
19:13:ERROR:(paperdoll.scp,15)Can't resolve <findlayer.12>
19:13:ERROR:(paperdoll.scp,15)Can't resolve <findlayer.13>
19:13:ERROR:(paperdoll.scp,15)Can't resolve <findlayer.14>
19:13:ERROR:(paperdoll.scp,15)Can't resolve <findlayer.15>
19:13:ERROR:(paperdoll.scp,15)Can't resolve <findlayer.16>
19:13:ERROR:(paperdoll.scp,15)Can't resolve <findlayer.17>
19:13:ERROR:(paperdoll.scp,15)Can't resolve <findlayer.18>
19:13:ERROR:(paperdoll.scp,15)Can't resolve <findlayer.19>
19:13:ERROR:(paperdoll.scp,15)Can't resolve <findlayer.20>
19:13:ERROR:(paperdoll.scp,15)Can't resolve <findlayer.21>
19:13:ERROR:(paperdoll.scp,15)Can't resolve <findlayer.22>
19:13:ERROR:(paperdoll.scp,15)Can't resolve <findlayer.23>
19:13:ERROR:(paperdoll.scp,15)Can't resolve <findlayer.24>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>
19:13:ERROR:(paperdoll.scp,22)Can't resolve <uid>

Why does functionally ?

Tnx for the reply...


RE: Paperdoll & Web - Avatar - 12-20-2013 10:03 AM

Hi admin_teclis,

May i ask you, on what object you called (f_set_mysphere_web) function ? Because findlayer refers to player <src> if you do realize. And also <addslashes > is a function that i'm using to add "/" in data to resolve the problem with syntax in mysql. I forgot to mention about addslashes function. I updated the content above. Just look at the addslashes function there.

In fact, what i have seen from your sphereserver log is nothing but referance problem of <uid>. You should call this function on player.

For instance you can directly use it on any event in @login trigger like ;

@login
f_set_mysphere_web // This will update paperdoll information in anytime player logins game.

Or you can make a function like [function paperdoll] and set a weblink under that. Before weblink call function like src.f_set_mysphere_web after that link the paperdoll or player.php according to player uid like "src.weblink blablabla.com/player.php?id=<eval <src.uid>> // Do not forget to change <uid> to decimal as i mentioned before.


RE: Paperdoll & Web - admin_teclis - 12-21-2013 11:06 PM

hi Avatar,
i added your function AddSlash... How can i create a function linked to player when player login? I add the function @ server start but this generated error.

Hi Avatar,
i succefully attached the @login on player event... But when i go to link on my web server return this :

http://solutionslab.it/ultima/screen.png


RE: Paperdoll & Web - Avatar - 12-22-2013 05:08 AM

Teclis,

Did you change inc file according to your information such as database username,password.
Also i forgot mention about something but as i said this php issue need some php knowledge.
You should create uofiles folder and in it, put gumpart.mul, gumpidx.mul, hues.mul and tiledata.mul.

Here you can download if you like, http://tns.gen.tr/Player_Database/uofiles/

Also, uo files listed in configuration files. If you just look at content of php files, especially inc files , you see what are the requirements.

*UPDATED*


RE: Paperdoll & Web - admin_teclis - 12-22-2013 06:18 AM

Sorry Avatar, but i have create a uofiles folder and put in a files, but the result is same... Another problem is status page... the status page not view a pg in the shard...

edit.... The file error is paperdoll.png this not stay in the images folder...


RE: Paperdoll & Web - amonvangrell - 12-22-2013 08:46 AM

What is this script about? I didn't understand... sry...


RE: Paperdoll & Web - admin_teclis - 12-22-2013 08:54 AM

look the example in first page... this script generate automatic paperdoll with your pg in game...

Avatar,
in the my image don't show a name of pg... Why?
i introduce the status page, but wich is the map region and location of pg? (sphere command for put in the DB)
And the date wich is the command sphere for put in DB?
Tnx for the help... I post the script sphere complete if you tell me the ask...