Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site and its forums as they stood in September 2005. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 1998–2001 UBB forums
Today on Apolyton WARDELL INTERVIEW PROMO A.C.S. HISTORY CHAPTER 4 GET CIV4 /w FREE PLUS! A.C.S. PHOTO GALLERY GET A.O.M. V1.1
Apolyton Civilization Forums
main| civ2| civ3| civ4| smac| ctp2| ron| moo3| galciv| galciv2| alt| about|
ApolytonPLUS | register | search | faq | new posts | pm (-/-) | upload | members
hall of fame new! | civgroups | civgroups news | interviews | the column | radio | chat | directory | news | store | PLUS
Apolyton Civilization Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Forums > Miscellaneous > Archive > CtP2-Creation/AI/Mods/Scenarios-Archive > IsHumanPlayer() in Multiplayer
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!

bottom of page
  
Author
Thread    < Last Thread     Next Thread > Post New Thread     Post A Reply
mapfi is offline mapfi
Prince
Zurich, Switzerland
Jul 2002
time: 06:22
  Old Post 12-10-2002 02:38
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
IsHumanPlayer() in Multiplayer Enter the AD-FREE zone

The question has been raised before (here: http://apolyton.net/forums/showthre...?threadid=62653)

Does the function IsHumanPlayer work properly in multiplayer games?

I did some testing tonight and here's what I found... (warning bad news!)

The one and only time the function would work in my setup was when it was a human player's turn (host or not) and the argument tested was his player number. No other player number would work when a human played and neither would it run on the AI's turns but there not even with the AI's player number as an argument.
The error returned is always "_IsHumanPlayer: Wrong number of arguments"
I can only think of some mistake in the code of the function itself which obviously renders it useless for any MP setup then...

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:22
Post  Old Post 31-12-2002 21:16 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Put an end to popups!

What was the exact code mapfi and did you tested it with DebugSlic=Yes?

-Martin

mapfi is offline mapfi
Prince
Zurich, Switzerland
Jul 2002
time: 06:22
  Old Post 02-01-2003 20:22
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Support Apolyton, pre-order Civilization IV

hm, that was a while ago already... I just wrote something for testing, like a BeginTurn handler that would give me the result of is humanplayer in a message box.

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:22
Post  Old Post 02-01-2003 23:18 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Support Apolyton, buy Alpha Centauri

So it would be something like this (if I use the information from your first post):

code:
HandleEvent(BeginTurn)'Test_IsHumanPlayer'post{ if(IsHumanPlayer(1)){ //Do something here } }


This could be a little bit problematic, because players and ints are not the same thing, in the slic documentation you find this:

player.owner - An integer version of the player.

This is a hint that ints and players are not identical, but obviously we have a lot of implecit typecasts here in slic, but unfortunatly they fail sometimes. And other functions expects a integer representaion of the player as argument.

I think something like this should work:

code:
HandleEvent(BeginTurn)'Test_IsHumanPlayer'post{ if(IsHumanPlayer(player[0])){ //Do something here } }


Also this could work:

code:
HandleEvent(BeginTurn)'Test_IsHumanPlayer'post{ player[0] = 1; if(IsHumanPlayer(player[0])){ //Do something here } }


And this should also work:

code:
HandleEvent(BeginTurn)'Test_IsHumanPlayer'post{ if(IsHumanPlayer(g.player)){ //Do something here } }


In frenzy we have the problem that ints and players treated as the same thing. Most of the frenzy arguments for the IsHumanPlayer function are integers and not players.

-Martin

mapfi is offline mapfi
Prince
Zurich, Switzerland
Jul 2002
time: 06:22
  Old Post 02-01-2003 23:41
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Tired of ads?

I honestly can't remember - I would think I did something like

code:
HandleEvent(BeginTurn) { for (i = 1; i <= Num; i = i + 1) { player[0] = i; result[i] = IsHumanPlayer(player[0]); } message(g.player, 'test'); }

but I wouldn't be able to swear on this... someone will have to try again, sorry

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:22
Post  Old Post 03-01-2003 01:46 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Suffering from ads?

Well this code will work as you described. Whenever the BeginTurn event is called a message is send to the current player (that's g.player) and no other player will recieve the message. In theory the result array should contain a lot of zeros and ones, but so far I don't see what do you want to do with the result array.

A code that could test it would be something like this:

code:
HandleEvent(BeginTurn)'Test_IsHumanPlayer'post{ if(IsHumanPlayer(player[0])){ Message(1, 'Test_IsHumanPlayer'); } else{ Message(1, 'Test_IsNotHumanPlayer'); } }

So if you are player 1 then you will receive a buch of messages, as much as human players are in the game, and you should get as much messages as AI players are in the game.

-Martin

  < Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:22.
Apolyton Time is 00:22.
    top of page
Rate This Thread:
archivepost
Forum Jump:
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
 




Contact Us - Apolyton Civilization Site - Support Us!

Building a better Apolyton through better information. Click here and take our poll!
Non-US visitors, click here!

Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.0308 seconds (86.30% PHP - 13.70% MySQL) with 31 queries
Page Loading Time:

Support Apolyton: Amazon USA | Amazon UK | Amazon DE | Amazon FR |
Support Apolyton and get FREE PLUS, Buy from Chips&Bits: Galactic Civilizations | Galactic Civilizations: Deluxe Edition | Call to Power 2 | Civilization: The Boardgame | GURPS/ Alpha Centauri | Alpha Centauri | Civilization IV | Civilization III: Complete |


Front Page | Civilization IV | Civilization III | Civilization II | Call to Power II | Alpha Centauri | Master of Orion III
Rise of Nations | Galactic Civilizations | Galactic Civilizations II | Misc
Alt.Civs | Civ I | C:CtP I | About | News | Directory | Apolyton Store | Forums | Chat | Columns | Interviews | Newsletter
Scenario League | CSC | Clash of Civs | Spanish Site | CtP Maps | Cradle of Civ | WesW's Ctp1/2 Site | Civ3 Haven

apolyton.net | apolyton.com | civilization2.net | civilization3.net | civilization4.net | civilizationiv.info | calltopower.net | galciv.net | galciv2.net | moo3.net