|
Server Help Community forums for Subgame, ASSS, and bots
|
Author |
Message |
Guest
Offline
|
|
Back to top |
|
|
Dr Brain Flip-flopping like a wind surfer
Age:38 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Sat Apr 02, 2011 9:46 pm Post subject: |
|
|
|
|
I'm no expert on ASSS python, but I think RegionName isn't the method you want. Your code doesn't actually check any coordinates.
Perhaps someone else can shed some light on the correct way to do this. _________________ Hyperspace Owner
Smong> so long as 99% deaths feel lame it will always be hyperspace to me |
|
Back to top |
|
|
Hakaku Server Help Squatter
Joined: Apr 07 2006 Posts: 299 Location: Canada Offline
|
Posted: Sun Apr 03, 2011 12:26 am Post subject: |
|
|
|
|
One thing that strikes me as weird about your code is the following:
Quote: | def cr (arena, p, bid):
___if mapdata.RegionName (cr):
______chat.SendArenaSoundMessage (arena, 1, "%s Attempted to make a goal within the crease. Goal not counted. Faceoff!" % (p.name))
______balls.SpawnBall (arena, 0)
___return cr |
Your argument 'cr' in mapdata.RegionName points right back to the entire function, and so it's invalid. Moreover, your return is also wrong as there's no element named 'cr' within your function to return (If you don't need to return anything, just leave 'return' on its own).
As Dr Brain pointed out, you're never actually comparing any coordinates. All that RegionName does is return the name of a given region. You'll want to use the mapdata function Contains(region,x,y) in conjunction with FindRegionByName(arena, name). The latter allows you to retrieve a region, while the former will search to see if the coordinates x and y are within that region. Thus, you could pair them like this:
rgn = mapdata.FindRegionByName(arena, "myfirstregionname")
if mapdata.Contains(rgn, 100, 600):
chat.SendArenaMessage(arena, "Here is a message") |
Since I assume you want to check to see whether the player is within the region, you'll have to get their coordinates using p.position[0] (x) and p.position[1] (y), and have them each divided by 16.
rgn = mapdata.FindRegionByName(arena, "myfirstregionname")
if mapdata.Contains(rgn, p.position[0] / 16, p.position[1] / 16):
chat.SendArenaMessage(arena, "Here is a message") |
|
|
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: 1231 page(s) served in previous 5 minutes.
|