|
Server Help Community forums for Subgame, ASSS, and bots
|
Author |
Message |
TurboSlug22 Newbie
Joined: Jun 12 2010 Posts: 1 Offline
|
Posted: Sat Jun 12, 2010 7:59 pm Post subject: Region activated LVZ popup via python module |
|
|
|
|
working with subgame for a decade
working with asss for a week
no background in programming
learning python so I can add some missing modules
getting overwhelmed but learning a lot
please help
---------------------------
Here's what I've got so far
I know I need to load in all the asss functions using:
from asss import *
And I know I'll need the region info using:
mapdata=get_interface(I_MAPDATA)
I suppose I'll also need information about player locations:
playerdata=get_interface(I_PLAYERDATA)
Then I need to interface with LVS's.. I think thats done like so:
objs=get_interface(I_OBJECTS)
However I'm not sure how to manipulate object data to get them to display in response to a player entering a region
Anyway I think I need some kind of definition which watches every few seconds to see if players are entering the region but I'm not sure how either.
So far I've got:
def paction(p, action, region)
region=mapdata.FindRegionByName(pb1)
Is this sortof near what I want? Obviously the timer is missing... but my region is called pb1
After which point, I'll need the asss equivalent of *objon but I'm not sure what that is either... I cant seem to find a comprehensive list of asss commands... I think its something like:
objs.Toggle(p, 5, 1)
is the 5 the ID of the lvz?
Anyway, I'd really appreciate it if you guys could help me tie all this together
Thanks in advance |
|
Back to top |
|
|
Samapico No, these DO NOT look like penises, ok?
Joined: May 08 2003 Posts: 1252 Offline
|
Posted: Sat Jun 12, 2010 8:21 pm Post subject: |
|
|
|
|
Pretty sure you can watch for some kind of region_enter event or something _________________ (Insert a bunch of dead links here) |
|
Back to top |
|
|
Cheese Wow Cheese is so helpful!
Joined: Mar 18 2007 Posts: 1017 Offline
|
Posted: Sat Jun 12, 2010 11:16 pm Post subject: |
|
|
|
|
there is no list of commands for asss
i made a ?cmdlist module, but it was for 1.4.4 and is somewhat dated
the only way to learn new commands is to have the source code or to ask people who know them already
use ?man objon _________________ SSC Distension Owner
SSCU Trench Wars Developer |
|
Back to top |
|
|
JoWie Server Help Squatter
Gender: Joined: Feb 25 2004 Posts: 215 Offline
|
Posted: Sun Jun 13, 2010 10:53 am Post subject: |
|
|
|
|
The region enter callback is not available to python. So you need to poll it.
Set a timer, loop over every player, see if they are within the region, check if they were previously in the region.
Something like:
from asss import *
def mm_attach(arena):
arena.myregion = mapdata.FindRegionByName(arena, "to#2")
if (not arena.myregion):
log.LogA(L_ERROR, "mymodule", arena, "Region not found")
def mm_detach(arena):
del arena.myregion
def check_region_timer():
def playerloop(p):
arena = p.arena
if not hasattr(arena, "myregion") or not arena.myregion:
return
if mapdata.Contains(arena.myregion, p.position[0] / 16, p.position[1] / 16):
if not hasattr(p, "in_myregion") or not p.in_myregion:
entered_myregion(p)
p.in_myregion = True
else:
if hasattr(p, "in_myregion") and p.in_myregion:
exited_myregion(p)
p.in_myregion = False
for_each_player(playerloop)
return 1 # repeat timer
def entered_myregion(p):
log.LogP(L_WARN, "mymodule", p, "Player entered myregion")
# ...
def exited_myregion(p):
log.LogP(L_WARN, "mymodule", p, "Player exited myregion")
# ...
mapdata = get_interface(I_MAPDATA)
log = get_interface(I_LOGMAN)
cfg = get_interface(I_CONFIG)
check_region_tmr = set_timer(check_region_timer, 5, 5)
|
In python, *objon 12 would be objs.Toggle(p, 12, 1) and *objoff 12 would be objs.Toggle(p, 12, 0) |
|
Back to top |
|
|
|
|
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
|
Software by php BB © php BB Group Server Load: 1204 page(s) served in previous 5 minutes.
|