View unanswered posts | View active topics
|
Page 1 of 1
|
[ 15 posts ] |
|
| Author |
Message |
|
MontuZ
|
Post subject: WriteHtml Posted: Wed Mar 01, 2006 12:41 pm |
|
Joined: Fri Feb 10, 2006 8:08 am Posts: 327 Location: Myrtle Beach, South Carolina
|
Instead of this ....
Code: Foreach Player in EnumerateOnlineCharacters() WriteHtml( Player.name + "<br>" ); Endforeach
I would like to not have WriteHtml(); run a whole crap load of times to display the name. I want to speed things up a bit. So my idea was this. Code: Var TheHTML := Array;
Foreach Player in EnumerateOnlineCharacters() TheHTML.Append( Player.name + "<br>" ); Endforeach
WriteHtml( TheHTML );
But when I tried that nothing comes up on the page.
If I do WriteHtmlRaw(); it shows up, but there's a bunch of
{,,,,,,,,,,,,,}
at the top of the page?
|
|
| Top |
|
 |
|
Mithril
|
Post subject: Posted: Wed Mar 01, 2006 3:19 pm |
|
Joined: Sat Feb 04, 2006 5:15 pm Posts: 25
|
Hmm, would this do the trick?
Code: var zHtmlText := ""; foreach mPlayer in EnumerateOnlineCharacters() zHtmlText := zHtmlText + mPlayer.Name + "<br>"; endforeach
WriteHtml(zHtmlText);
My Html is pretty rusty so I don't remember if the <br> tag does a newline or not...
|
|
| Top |
|
 |
|
FreeSoul
|
Post subject: Posted: Wed Mar 01, 2006 5:13 pm |
|
Joined: Sat Feb 04, 2006 9:14 am Posts: 90 Location: Aman
|
|
WriteHtml( html )
Parameters:
html: String
you cant use array in that function
<br> makes newline
|
|
| Top |
|
 |
|
MontuZ
|
Post subject: Posted: Wed Mar 01, 2006 6:43 pm |
|
Joined: Fri Feb 10, 2006 8:08 am Posts: 327 Location: Myrtle Beach, South Carolina
|
I guess I always have to make things complicated, lol.
Worked, dunno why I didn't think of that first.
Here's the result. Players Online
|
|
| Top |
|
 |
|
Harley
|
Post subject: Posted: Thu Mar 23, 2006 10:47 am |
|
Joined: Sat Mar 18, 2006 1:41 am Posts: 92 Location: World Earth
|
|
I'm verry sorry, but! Dear Unreal, how you have created Kills & Deaths info??? If you can help me, please.
|
|
| Top |
|
 |
|
Althalus
|
Post subject: Posted: Tue Mar 28, 2006 7:43 am |
|
Joined: Fri Feb 17, 2006 5:34 pm Posts: 12
|
probably from props
SetObjProperty(smbdy, "stats", {kills, deaths}); in combat and counting every kill/death;
then in view script
var stats := GetObjProperty(smbdy, "stats");
var kills := stats[1];
var deaths := stats[2];

_________________ Master of dis(ass)ter
|
|
| Top |
|
 |
|
Harley
|
Post subject: Posted: Fri Mar 31, 2006 7:21 am |
|
Joined: Sat Mar 18, 2006 1:41 am Posts: 92 Location: World Earth
|
I not verry good understand where "SetObjProperty(smbdy, "stats", {kills, deaths});" in combat, but! I have placed this lines at my statics script and I have one trouble:
Kills error{ errortext = "Property not found" }
Deaths error{ errortext = "Property not found" }
This is not good!
Please, paint to me lines what are necessary for display of statistics and write to me where they should be inserted! Thanks. p.s. I'm noob also has not reached yet up to properties. Big Thanks! :-* 
|
|
| Top |
|
 |
|
FreeSoul
|
Post subject: Posted: Fri Mar 31, 2006 10:53 am |
|
Joined: Sat Feb 04, 2006 9:14 am Posts: 90 Location: Aman
|
in combat pkg
after dealing damage if (tgt.dead) kills + 1 /target was PC increase kills for attacker and death + 1 /increase deaths for defender
if (!tgt) kills + 1 // target was npc so there is no ghost of it
well
Code: (...) applyrawdamage(defender,amt); if (defender.dead && defender.acctname) if (!getobjproperty(defender,"DEATH")) setobjproperty(defender,"DEATH",1); else setobjproperty(defender,"DEATH",getobjproperty(defender,"DEATH")+1); endif if (attacker.acctname) if (!getobjproperty(attacker,"KILLS")) setobjproperty(attacker,"KILLS",1); else setobjproperty(attacker,"KILLS",getobjproperty(attacker,"KILLS")+1); endif endif elseif (!defender && !defender.acctname && attacker.acctname) if (!getobjproperty(attacker,"KILLS")) setobjproperty(attacker,"KILLS",1); else setobjproperty(attacker,"KILLS",getobjproperty(attacker,"KILLS")+1); endif endif (...)
sth. like that. don't know is it working... (don't have time for tests)
|
|
| Top |
|
 |
|
Harley
|
Post subject: Posted: Fri Mar 31, 2006 12:35 pm |
|
Joined: Sat Mar 18, 2006 1:41 am Posts: 92 Location: World Earth
|
FreeSoul, I'm very much grateful to you, but! Where exactly I would insert these lines?
Unreal, if you read this top, help pleeease!!! I study scripting on Zulu Hotel, and I would think you could help me with it! You are master, can I be your Margarita, Unreal  )
I will be for you very grateful!
|
|
| Top |
|
 |
|
MuadDib
|
Post subject: Posted: Fri Mar 31, 2006 12:52 pm |
|
 |
| POL Developer |
 |
Joined: Sun Feb 12, 2006 9:50 pm Posts: 836 Location: Indiana, USA
|
Some will consider this useless, because of the extra characters (thus, enlarging the amount of bandwidth used), but I like it looking good too when I can.
Code: foreach Player in EnumerateOnlineCharacters() zHtmlText := zHtmlText + mPlayer.Name + "<br> \n"; endforeach
WriteHtml(zHtmlText);
Why the \n ? It will make the code dumped to the web browser to have newlines, and the code look a bit better in my opinion. Just a thought. 
|
|
| Top |
|
 |
|
Marilla
|
Post subject: Posted: Fri Mar 31, 2006 1:09 pm |
|
|
|
|
Yup, I prefer it like that myself, too, rather than having a single 'brick' of text, as it were.
Whenever I use the WWW service to emit XML, for example, I always like to have newlines in the appropriate places!
|
|
| Top |
|
 |
|
MuadDib
|
Post subject: Posted: Fri Mar 31, 2006 1:12 pm |
|
 |
| POL Developer |
 |
Joined: Sun Feb 12, 2006 9:50 pm Posts: 836 Location: Indiana, USA
|
Might have to go through my old ShardStatus Aux system. Update it some, maybe make an addon for the Distro guild system like my old LS shard had for it (to give guild information and all also). Who knows.
Been debating releasing parts of the old LS code anyway even though a lot of it was incomplete. May spark ideas for people, never know, hehe.
Maybe even complete my MySQL export package 
|
|
| Top |
|
 |
|
FreeSoul
|
Post subject: Posted: Fri Mar 31, 2006 1:13 pm |
|
Joined: Sat Feb 04, 2006 9:14 am Posts: 90 Location: Aman
|
Quote: MYSQL export package YES YES YES  now about death stats... :combat:fight.inc Code: use uo; use util; include "include/givefightpoints"
function DealDamage(defender, attacker, rawdamage,skill) //here some code if (defender.dead || !defender) eraseobjproperty(defender,"wounded"); fix_stats(attacker,defender); endif endif endfunction
include/givefightpoints.inc Code: const ATT_KILLED_NPC := 10; const ATT_KILLED_PC := 11; const DEF_KILLED_BY_NPC := 21;
function fix_stats(attacker,defender) var tmp1,tmp2,tmp3,tmp4,def:=0,ata:=20,i; if (defender.acctname) def:=1; if (getobjproperty(defender,"deathstats")) tmp1:=getobjproperty(defender,"deathstats"); else tmp1:=array("0","0","0","0"); endif if (getobjproperty(defender,"viccas")) tmp3:=getobjproperty(defender,"viccas"); else tmp3:=array("","","","","","","","","","","","","","","",""); endif endif if (attacker.acctname) ata:=10; if (getobjproperty(attacker,"deathstats")) tmp2:=getobjproperty(attacker,"deathstats"); else tmp2:=array("0","0","0","0"); endif if (getobjproperty(attacker,"viccas")) tmp4:=getobjproperty(attacker,"viccas"); else tmp4:=array("","","","","","","","","","","","","","","",""); endif endif var przypadek:=def+ata; if (przypadek == ATT_KILLED_NPC) tmp2[1]:=cstr(cint(tmp2[1])+1); setobjproperty(attacker,"deathstats",tmp2); UpdMyKills(attacker, defender); endif if (przypadek == ATT_KILLED_PC) tmp2[2]:=cstr(cint(tmp2[2])+1); tmp1[4]:=cstr(cint(tmp1[4])+1); setobjproperty(attacker,"deathstats",tmp2); setobjproperty(defender,"deathstats",tmp1); for (i:=7;i>0;i:=i-1); tmp4[i+1]:=tmp4[i]; tmp3[i+9]:=tmp3[i+8]; endfor tmp4[1]:=defender.name; tmp3[9]:=attacker.name; setobjproperty(attacker,"viccas",tmp4); setobjproperty(defender,"viccas",tmp3); UpdMyKills(attacker, defender); UpdMyDeaths(defender, attacker); endif if (przypadek == DEF_KILLED_BY_NPC) tmp1[3]:=cstr(cint(tmp1[3])+1); setobjproperty(defender,"deathstats",tmp1); UpdMyDeaths(defender, attacker); endif endfunction
// Victim Ref Could Be Null If It Was NPC - death.src Uses This Function Directly With CorpseRef As Victim // function UpdMyKills(killer, victim) var mykills := GetObjProperty(killer, "my_kills"); var tmp; var npc_temp := GetObjProperty(victim, "npctemplate"); if (!mykills || (TypeOf(mykills) != "Dictionary")) mykills := dictionary; endif // Killed a PC // if (victim.acctname) var race := CInt(GetObjProperty(victim, "race")); if ((race < 0) || (race > 11)) return; endif
tmp := CInt(mykills[CStr(race)]); mykills[CStr(race)] := tmp + 1; SetObjProperty(killer, "my_kills", mykills); // Killed a NPC // elseif (npc_temp)
tmp := CInt(mykills[CStr(npc_temp)]); mykills[CStr(npc_temp)] := tmp + 1; SetObjProperty(killer, "my_kills", mykills); endif endfunction
// Here Killer Ref Is Always Valid // function UpdMyDeaths(victim, killer) var mydeaths := GetObjProperty(victim, "my_deaths"); var tmp; if (!mydeaths || (TypeOf(mydeaths) != "Dictionary")) mydeaths := dictionary; endif
// Killed by a PC // if (killer.acctname) var race := CInt(GetObjProperty(killer, "race")); if ((race < 0) || (race > 11)) return; endif
tmp := CInt(mydeaths[CStr(race)]); mydeaths[CStr(race)] := tmp + 1; SetObjProperty(victim, "my_deaths", mydeaths);
// Killed by a NPC // elseif (killer.npctemplate)
tmp := CInt(mydeaths[CStr(killer.npctemplate)]); mydeaths[CStr(killer.npctemplate)] := tmp + 1; SetObjProperty(victim, "my_deaths", mydeaths); endif endfunction
if (defender.dead || !defender) eraseobjproperty(defender,"wounded"); fix_stats(attacker,defender); endif should be too after dealing damages by spells var tmp1:=GetObjProperty(who,"deathstats"); var tmp2:=getobjproperty(defender,"viccas"); var tmp3:=GetObjProperty(who, "my_deaths"); var tmp4:=GetObjProperty(who, "my_kills"); and you have something like this (look only at data not design of usercard):      [/quote]
|
|
| Top |
|
 |
|
qrak
|
Post subject: Posted: Fri Mar 31, 2006 9:52 pm |
|
Joined: Sun Feb 05, 2006 4:35 pm Posts: 161 Location: Poland
|
Nice FreeSoul. Is it Endore shard? 
_________________ Shutdown();
|
|
| Top |
|
 |
|
Harley
|
Post subject: Posted: Sat Apr 01, 2006 12:59 am |
|
Joined: Sat Mar 18, 2006 1:41 am Posts: 92 Location: World Earth
|
|
Oh!!! Das ist Fantastisch! FreeSoul, please give me at private msg your icq. I have one business! Thanks.
p.s. But what me contain in a script of statistics of a server?
|
|
| Top |
|
 |
|
Page 1 of 1
|
[ 15 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 0 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|

|