Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Help please

 
Post new topic   Reply to topic Printable version
 View previous topic  CNC Generals (half-done) Post :: Post ballmover  View next topic  
Author Message
Chambahs
Power attack
Power attack


Joined: Jun 19 2005
Posts: 820
Offline

PostPosted: Fri Jan 06, 2006 12:25 am    Post subject: Help please Reply to topic Reply with quote

Ive gone through this module over and over again, and i cant seem to find what is wrong with it. I get no error messages, no nothing. The module just doesnt work. ?start1 does nothing and I really dont know why.


Code: Show/Hide

from asss import *

chat = get_interface(I_CHAT)
game = get_interface(I_GAME)

def count_playing(arena):
    players = [ 0 ]
    def cb_count(p):
        if p.arena == arena and p.ship < SHIP_SPEC:
             players[0] += 1
    for_each_player(cb_count)
    return players[0]

def kill(arena, killer, killed, bounty, flags, pts, green):
    # promote
    if killer.ship != SHIP_WARBIRD:
        game.SetShip(killer, killer.ship - 1)

    # check for game over
    elif killer.ship == SHIP_WARBIRD:
        arena.leader_killcb = None
        chat.SendArenaMessage(arena, "Game over. %s is the winner!" % killer.p.name)

    # demote
    if killed.ship != SHIP_SHARK:
        game.SetShip(killed, killed.ship + 1)

    return pts, green

def c_start_game(cmd, params, p, targ):
    """\
Module: <py> leader
Min. players: 2
Everyone starts as Shark, kill to get ship changed.
First to make a kill in a Warbird wins.
"""
    players = count_playing(p.arena)

    if players >= 2:
        def cb_setship(i):
            if i.arena == arena and i.ship < SHIP_SPEC:
                game.SetShip(i, SHIP_SHARK)
        for_each_player(cb_setship)

        chat.SendArenaMessage(p.arena, "The Game Has Started, Begin Killing To Get Promoted. If You Are Killed You Will Get Demoted.")
        game.LockArena(p.arena, 0, 0, 0, 0)
    else:
        chat.SendArenaMessage(p.arena, "Not enough players, %d more needed." % (2 - players))

cmd1 = add_command("startl", c_start_game)

def mm_attach(arena):
    arena.leader_killcb = reg_callback(CB_KILL, kill, arena)

def mm_detach(arena):
    arena.leader_killcb = None
    arena.leader_cmd1 = None

Back to top
View users profile Send private message Add User to Ignore List
Muskrat
Server Help Squatter


Age:36
Joined: Aug 24 2004
Posts: 829
Location: Swamp
Offline

PostPosted: Fri Jan 06, 2006 12:41 am    Post subject: Reply to topic Reply with quote

Sure you put the command in the groupdef files? It looks like it should at least be doing something.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Chambahs
Power attack
Power attack


Joined: Jun 19 2005
Posts: 820
Offline

PostPosted: Fri Jan 06, 2006 12:47 am    Post subject: Reply to topic Reply with quote

everything is done in the confs, i attached, i did everything, all that good stuff lol
Back to top
View users profile Send private message Add User to Ignore List
Grelminar
Creator of Asss


Joined: Feb 26 2003
Posts: 378
Offline

PostPosted: Fri Jan 06, 2006 3:12 am    Post subject: Reply to topic Reply with quote

Something is a little confused. You probably meant to do add the command like this:
Code: Show/Hide
def mm_attach(arena):
    arena.leader_cmd1 = add_command("start1", c_start_game, arena)


So that the command is only defined for arenas where this is attached, and then register the callback in c_start_game.

Besides that, I don't see anything wrong.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
Chambahs
Power attack
Power attack


Joined: Jun 19 2005
Posts: 820
Offline

PostPosted: Fri Jan 06, 2006 3:18 pm    Post subject: Reply to topic Reply with quote

Thanks grel, although there were some p's places there should be and other tiny things. But on the way of fixing the module i realized there are great bugs. Like when your in game you can spec and the game will keep going. Another is you can ?startgame over and over. I tried to fix a number of these but they failed once again. Here is the new working but still buggy leader module.

Code: Show/Hide

#Leader by Chambahs
#12-16-05
#dec 29 2005 smong
#Chambahs jan 06, bugs and ect.

from asss import *

chat = get_interface(I_CHAT)
game = get_interface(I_GAME)

def count_playing(arena):
    players = [ 0 ]
    def cb_count(p):
        if p.arena == arena and p.ship < SHIP_SPEC:
             players[0] += 1
    for_each_player(cb_count)
    return players[0]

def c_start_game(cmd, params, p, targ):
    """\
Module: <py> leader
Min. players: 2
Everyone starts as Shark, kill to get ship changed.
First to make a kill in a Warbird wins.
"""
    players = count_playing(p.arena)

    if players >= 2:
        def cb_setship(i):
            if i.arena == p.arena and i.ship < SHIP_SPEC:
                game.SetShip(i, SHIP_SHARK)
        for_each_player(cb_setship)

        chat.SendArenaMessage(p.arena, "The Leader Game Has Started By: " + p.name + ", Begin Killing To Get Promoted. If You Are Killed You Will Get Demoted.")
        game.LockArena(p.arena, 0, 0, 0, 0)
    else:
        chat.SendArenaMessage(p.arena, "Not Enough Players, %d More Needed." % (2 - players))

def kill(arena, killer, killed, bounty, flags, pts, green):
    # promote
    if killer.ship != SHIP_WARBIRD:
        game.SetShip(killer, killer.ship - 1)

    # check for game over
    players = count_playing(arena)

    if players < 2:
        arena.leader_killcb = None
        chat.SendArenaMessage(arena, "Game over. %s is the winner!" % killer.name)

    elif killer.ship == SHIP_WARBIRD:
        arena.leader_killcb = None
        chat.SendArenaMessage(arena, "Game over. %s is the winner!" % killer.name)
       
    # demote
    if killed.ship != SHIP_SHARK:
        game.SetShip(killed, killed.ship + 1)

    return pts, green

def mm_attach(arena):
    arena.leader_killcb = reg_callback(CB_KILL, kill, arena)
    arena.leader_cmd1 = add_command("startgame", c_start_game, arena)
    arena.leader_cmd2 = add_command("stopgame", do_game_over, arena)
   
def mm_detach(arena):
    arena.leader_killcb = None
    arena.leader_cmd1 = None
    arena.leader_cmd2 = None


Whoever wants to help work on it, be my guest.
Back to top
View users profile Send private message Add User to Ignore List
Cyan~Fire
I'll count you!
I'll count you!


Age:36
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Fri Jan 06, 2006 3:51 pm    Post subject: Reply to topic Reply with quote

You want us to locate your bugs for you?
_________________
This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
D1st0rt
Miss Directed Wannabe


Age:36
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Fri Jan 06, 2006 3:58 pm    Post subject: Reply to topic Reply with quote

You haven't been on the bot chat very much have you, Cyan?
_________________

Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Chambahs
Power attack
Power attack


Joined: Jun 19 2005
Posts: 820
Offline

PostPosted: Fri Jan 06, 2006 4:23 pm    Post subject: Reply to topic Reply with quote

LIES, i know what my bugs are, i said specifically:

"Whoever wants to help work on it, be my guest."

i didnt say: "I dont know whats wrong can you please find my bugs for me"

I stated the bugs and said this is whats wrong with the module, if you want it...take it, if you dont, then dont mind this thread. So -READ- before you -POST- thank you very much.
Back to top
View users profile Send private message Add User to Ignore List
Cyan~Fire
I'll count you!
I'll count you!


Age:36
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Fri Jan 06, 2006 10:53 pm    Post subject: Reply to topic Reply with quote

Never, as far as I know, d1s.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Mon Jan 09, 2006 4:17 am    Post subject: Reply to topic Reply with quote

I don't see a do_game_over function, you should try and write one.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Chambahs
Power attack
Power attack


Joined: Jun 19 2005
Posts: 820
Offline

PostPosted: Mon Jan 09, 2006 10:08 am    Post subject: Reply to topic Reply with quote

i did smong, its just it didnt work and looked crappy so i deleted it
Back to top
View users profile Send private message Add User to Ignore List
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Custom Projects All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 650 page(s) served in previous 5 minutes.

phpBB Created this page in 0.568460 seconds : 36 queries executed (80.5%): GZIP compression disabled