Calling attacks from screen buttons, now with error report!
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
-
- Veteran
- Posts: 277
- Joined: Fri Aug 17, 2007 9:59 am
- Completed: Tour de Pharmacy (Proofreader), The Abandoned Land: Book One (Proofreader)
- Projects: Raven Hollow (Core Coder, Proofreader), The Universal Hope (Core Coder, Proofreader)
- Organization: FlareBlue Entertainment
- Location: Always somewhere behind you...
- Contact:
Re: Calling attacks from screen buttons, now with error repo
Been away for a few days, thanks for the replies everyone.
Xela, kankan, you're both stars. Seriously, thank you ^^
Xela, kankan, you're both stars. Seriously, thank you ^^
Without communication, nothing is possible.
Universal Hope Stalled
Raven Hollow (on hold for now)
"All we see or seem
Is but a dream within a dream.
I stand amid the roar
Of a surf-tormented shore"
-- Edgar Allen Poe, "A Dream Within A Dream"
Current Projects:Is but a dream within a dream.
I stand amid the roar
Of a surf-tormented shore"
-- Edgar Allen Poe, "A Dream Within A Dream"
Universal Hope Stalled
Raven Hollow (on hold for now)
Peace and Love,
Squark
Squark
-
- Veteran
- Posts: 277
- Joined: Fri Aug 17, 2007 9:59 am
- Completed: Tour de Pharmacy (Proofreader), The Abandoned Land: Book One (Proofreader)
- Projects: Raven Hollow (Core Coder, Proofreader), The Universal Hope (Core Coder, Proofreader)
- Organization: FlareBlue Entertainment
- Location: Always somewhere behind you...
- Contact:
Re: Calling attacks from screen buttons, now with error repo
That didn't mean it's fixed, by the way. If it was, I'd have marked it solved. I do appreciate the help
However, as easy to insert as this code seems, the problem it now poses to me is how to rewrite the system so it doesn't call the Execution Phase.
Otherwise it seems absolutely perfect to my predicament.
However, as easy to insert as this code seems, the problem it now poses to me is how to rewrite the system so it doesn't call the Execution Phase.
Otherwise it seems absolutely perfect to my predicament.
Without communication, nothing is possible.
Universal Hope Stalled
Raven Hollow (on hold for now)
"All we see or seem
Is but a dream within a dream.
I stand amid the roar
Of a surf-tormented shore"
-- Edgar Allen Poe, "A Dream Within A Dream"
Current Projects:Is but a dream within a dream.
I stand amid the roar
Of a surf-tormented shore"
-- Edgar Allen Poe, "A Dream Within A Dream"
Universal Hope Stalled
Raven Hollow (on hold for now)
Peace and Love,
Squark
Squark
Re: Calling attacks from screen buttons, now with error repo
And once again, you did not post the latest version of the codesquark wrote:That didn't mean it's fixed, by the way. If it was, I'd have marked it solved. I do appreciate the help
However, as easy to insert as this code seems, the problem it now poses to me is how to rewrite the system so it doesn't call the Execution Phase.
Otherwise it seems absolutely perfect to my predicament.
-
- Veteran
- Posts: 277
- Joined: Fri Aug 17, 2007 9:59 am
- Completed: Tour de Pharmacy (Proofreader), The Abandoned Land: Book One (Proofreader)
- Projects: Raven Hollow (Core Coder, Proofreader), The Universal Hope (Core Coder, Proofreader)
- Organization: FlareBlue Entertainment
- Location: Always somewhere behind you...
- Contact:
Re: Calling attacks from screen buttons, now with error repo
I finally have enough free time to work on this again, but the original issue remains. It hasn't been about the Special attacks themselves; but how to get the buttons to use them was the problem.
Unless I've gone horribly blind I haven't seen the function to use.
So let's backtrack slightly. If I have this:what action do I tell it to use?
Also, let's assume that "stab" is defined in much the same manner as kankan's normalSkill piece.
All I want is the right action to call the stab class and resolve it.
Unless I've gone horribly blind I haven't seen the function to use.
So let's backtrack slightly. If I have this:
Code: Select all
textbutton "stab" action
Also, let's assume that "stab" is defined in much the same manner as kankan's normalSkill piece.
All I want is the right action to call the stab class and resolve it.
Without communication, nothing is possible.
Universal Hope Stalled
Raven Hollow (on hold for now)
"All we see or seem
Is but a dream within a dream.
I stand amid the roar
Of a surf-tormented shore"
-- Edgar Allen Poe, "A Dream Within A Dream"
Current Projects:Is but a dream within a dream.
I stand amid the roar
Of a surf-tormented shore"
-- Edgar Allen Poe, "A Dream Within A Dream"
Universal Hope Stalled
Raven Hollow (on hold for now)
Peace and Love,
Squark
Squark
-
- Veteran
- Posts: 277
- Joined: Fri Aug 17, 2007 9:59 am
- Completed: Tour de Pharmacy (Proofreader), The Abandoned Land: Book One (Proofreader)
- Projects: Raven Hollow (Core Coder, Proofreader), The Universal Hope (Core Coder, Proofreader)
- Organization: FlareBlue Entertainment
- Location: Always somewhere behind you...
- Contact:
Re: Calling attacks from screen buttons, now with error repo
Okay, I'm really not getting this. I've decided to use classes and defs (which make the a logical choice). But here's my next problem. I learned recently that I can use custom Actions.
But again I run into a stumbling block. Here's a logical rundown of what I thought would happen - with code pieces.
1: Player chooses an action, in this case "Doom".
And Doom is contained in this class:
I'm sure someone has already spotted something wrong, but I'll go on anyway.
This piece is supposed to grab the screen action from the gui:
But it doesn't seem to work with the way I've set out the classes.
It should then execute the command and continue to resolve the round. Instead, upon clicking, I get this:
(I've tried kankan's method, and while it would work in a different project, I get the feeling that it's just not suitable for this one. Just a gut feeling.)
So, this is the most recent changes I've made to the code. Please help me.
But again I run into a stumbling block. Here's a logical rundown of what I thought would happen - with code pieces.
1: Player chooses an action, in this case "Doom".
Code: Select all
textbutton "Doom of Darkness" action (Show("targetChoice", env=env), Doom())
Code: Select all
class Doom(Action):
def doomy(self, pEnemy):
if phi.mp_temp >= 10:
self.env.describe("Darkness envelopes the enemy...")
Enemy.life_temp = int(Enemy.life_temp - (Enemy.life_temp * 0-.33))
phi.mp_temp -= 10
else:
self.env.describe("Phi does not have enough MP to use that!")
pass
This piece is supposed to grab the screen action from the gui:
Code: Select all
def preparationPhase(self):
self.guiAction = renpy.call_screen("Combat", env=self) # Use the GUI to get the player action
self.setAction()
for enemy in self.enemies: # Set all enemy actions
self.guiAction = enemy.ai(self) # Call the ai function to determine the action used
self.setAction()
self.que.sort()
if not self.doEscape:
self.executionPhase() # After all actions are set, move on to the next phase
else:
self.escape()
def setAction(self):
for entry in self.guiAction:
self.que.addAction(entry)
It should then execute the command and continue to resolve the round. Instead, upon clicking, I get this:
Yes, I'm still using 6.13. That's because I'm happy with it. I may need to to update soon, though. Things appear to be changing and deprecating to the point of total obsoletion into not being used anymore.traceback wrote: While running game code:
File "game/script.rpy", line 39, in script
python:
File "game/script.rpy", line 42, in python
ybt2.preparationPhase()
File "game/enviroment.rpy", line 35, in python
self.guiAction = renpy.call_screen("Combat", env=self) # Use the GUI to get the player action
TypeError: 'NotImplementedType' object is not callable
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "C:\Games\Dev\renpy\renpy\execution.py", line 261, in run
File "C:\Games\Dev\renpy\renpy\ast.py", line 630, in execute
File "C:\Games\Dev\renpy\renpy\python.py", line 978, in py_exec_bytecode
File "game/script.rpy", line 42, in <module>
File "game/enviroment.rpy", line 35, in preparationPhase
File "C:\Games\Dev\renpy\renpy\exports.py", line 1530, in call_screen
File "C:\Games\Dev\renpy\renpy\ui.py", line 237, in interact
File "C:\Games\Dev\renpy\renpy\display\core.py", line 1798, in interact
File "C:\Games\Dev\renpy\renpy\display\core.py", line 2322, in interact_core
File "C:\Games\Dev\renpy\renpy\display\layout.py", line 714, in event
File "C:\Games\Dev\renpy\renpy\display\layout.py", line 714, in event
File "C:\Games\Dev\renpy\renpy\display\layout.py", line 714, in event
File "C:\Games\Dev\renpy\renpy\display\screen.py", line 297, in event
File "C:\Games\Dev\renpy\renpy\display\layout.py", line 714, in event
File "C:\Games\Dev\renpy\renpy\display\layout.py", line 174, in event
File "C:\Games\Dev\renpy\renpy\display\layout.py", line 714, in event
File "C:\Games\Dev\renpy\renpy\display\behavior.py", line 623, in event
File "C:\Games\Dev\renpy\renpy\display\behavior.py", line 197, in run
File "C:\Games\Dev\renpy\renpy\ui.py", line 56, in __call__
TypeError: 'NotImplementedType' object is not callable
Windows-post2008Server-6.1.7601-SP1
Ren'Py 6.13.7.1646
Combat System Prototype 0.6 0.6
(I've tried kankan's method, and while it would work in a different project, I get the feeling that it's just not suitable for this one. Just a gut feeling.)
So, this is the most recent changes I've made to the code. Please help me.
Without communication, nothing is possible.
Universal Hope Stalled
Raven Hollow (on hold for now)
"All we see or seem
Is but a dream within a dream.
I stand amid the roar
Of a surf-tormented shore"
-- Edgar Allen Poe, "A Dream Within A Dream"
Current Projects:Is but a dream within a dream.
I stand amid the roar
Of a surf-tormented shore"
-- Edgar Allen Poe, "A Dream Within A Dream"
Universal Hope Stalled
Raven Hollow (on hold for now)
Peace and Love,
Squark
Squark
-
- Veteran
- Posts: 277
- Joined: Fri Aug 17, 2007 9:59 am
- Completed: Tour de Pharmacy (Proofreader), The Abandoned Land: Book One (Proofreader)
- Projects: Raven Hollow (Core Coder, Proofreader), The Universal Hope (Core Coder, Proofreader)
- Organization: FlareBlue Entertainment
- Location: Always somewhere behind you...
- Contact:
Re: Calling attacks from screen buttons, now with error repo
Okay, slight alteration.
I'd taken a long, long break to get my head and some other affairs in order. So, I went back and tried something else.
I made a slight change to the character data I'm using:
I've probably made a mistake there already. I'm already defined them as classes like so:
Phi is already defined as a character elsewhere, and that much is okay.
Then, I use buttons to attempt to execute the above class actions. (Note that I've already tried class yadayada(Action):, and that also returns errors)
So, when I try to this, it gives me this:
And rightly so, I believe. It's because classes have no call function. So how do I get it to do what I want, which is to determine what to do next, based on the instructions contained in the classes?
I'd taken a long, long break to get my head and some other affairs in order. So, I went back and tried something else.
I made a slight change to the character data I'm using:
Code: Select all
class Characters(Combatant):
def __init__(self, pName, pInventory, pGear):
self.name = pName
# Attributes
self.life = 100
self.life_temp = self.life # Temporary
self.mp = 100
self.mp_temp = self.mp # Temporary
self.attack = 45
self.speed = 30
self.defense = 20
self.evade = 15
self.arcane = 30
self.inventory = pInventory # Starting Inventory
self.gear = pGear # Starting Gear object
self.xp = 0 # Starting experience
self.level = 1 # Starting level
self.defending_temp = False
self.active = True
# Skills
self.skills = [ [Slash], [Doomy], [CheapHealing], [Instadoom], [Apaches], [Gamblor] ]
Code: Select all
class Doomy():
def Doom(self, pEnemy):
if phi.mp_temp >= 10:
self.env.describe("Darkness envelopes the enemy...")
phi.attack = int(Enemy.life_temp - (Enemy.life_temp * 0.33))
phi.mp_temp -= 10
else:
self.env.describe("Phi does not have enough MP to use that!")
pass
Then, I use buttons to attempt to execute the above class actions. (Note that I've already tried class yadayada(Action):, and that also returns errors)
Code: Select all
screen attackChoice:
modal True
frame:
xalign 0.5 yalign 0.95
vbox:
textbutton "Sword" action (Show("targetChoice", env=env), Hide("attackChoice"))
textbutton "Doom of Darkness" action (Show("targetChoice", env=env), Hide("attackChoice"), Doomy())
textbutton "Cast Into The Shadows" action (Show("targetChoice", env=env), Hide("attackChoice"), Apaches())
textbutton "Sparrow of The Wind" action (Show("targetChoice", env=env), Hide("attackChoice"), Instadoom())
frame:
xalign 0.85 yalign 0.95
vbox:
textbutton "Evening Muster" action (Show("targetChoice", env=env), Hide("attackChoice"), Gamblor())
textbutton "HOPE it all" action (Show("targetChoice", env=env), Hide("attackChoice"), CheapHealing())
textbutton "Cancel" action Hide("attackChoice")
Code: Select all
While running game code:
File "game/missionstart.rpy", line 37, in script
python:
File "game/missionstart.rpy", line 39, in python
ybt2.preparationPhase()
File "game/enviroment.rpy", line 35, in python
self.guiAction = renpy.call_screen("Combat", env=self) # Use the GUI to get the player action
AttributeError: Apaches instance has no __call__ method
Without communication, nothing is possible.
Universal Hope Stalled
Raven Hollow (on hold for now)
"All we see or seem
Is but a dream within a dream.
I stand amid the roar
Of a surf-tormented shore"
-- Edgar Allen Poe, "A Dream Within A Dream"
Current Projects:Is but a dream within a dream.
I stand amid the roar
Of a surf-tormented shore"
-- Edgar Allen Poe, "A Dream Within A Dream"
Universal Hope Stalled
Raven Hollow (on hold for now)
Peace and Love,
Squark
Squark
Who is online
Users browsing this forum: Amazon [Bot], chesarty, Google [Bot], Semrush [Bot]