Welcome, Guest. Please login or register.
Kingdoms of Ahln
Pages: [1]
  Print  
Author Topic: Using acreate to create a player object crashes the game.  (Read 877 times)
Saffire
Citizen
***
Posts: 136


View Profile
« on: November 15, 2008, 02:06:41 pm »

Here's a log dump, starting from when I used the command "acreate player saffire" all the way until the server finished restarting.

[11/15/08 14:04:34 Manager]: Got event: #<Event action=acreate, type=Admin, name=saffire, player=#<Player:0x35a9260>(Ellah|57a65eca-ae04-6079-bf53-55da34b5d12e), object=player>
[11/15/08 14:04:34 Server]: #<ArgumentError: wrong number of arguments (0 for 3)>
[11/15/08 14:04:34 Server]: ./components/manager.rb:131:in `initialize'
./components/manager.rb:131:in `new'
./components/manager.rb:131:in `create_object'
./events/admin.rb:80:in `acreate'
./components/eventhandler.rb:59:in `send'
./components/eventhandler.rb:59:in `handle_event'
./components/eventhandler.rb:22:in `run'
./components/manager.rb:298:in `update'
c:/ruby/lib/ruby/1.8/observer.rb:185:in `notify_observers'
c:/ruby/lib/ruby/1.8/observer.rb:184:in `each'
c:/ruby/lib/ruby/1.8/observer.rb:184:in `notify_observers'
./objects/player.rb:219:in `handle_input'
./lib/login.rb:36:in `receive_data'
./lib/login.rb:29:in `each'
./lib/login.rb:29:in `receive_data'
c:/ruby/lib/ruby/gems/1.8/gems/eventmachine-0.12.0-i386-mswin32/lib/eventmachine.rb:224:in `run_machine'
c:/ruby/lib/ruby/gems/1.8/gems/eventmachine-0.12.0-i386-mswin32/lib/eventmachine.rb:224:in `run'
C:/Documents and Settings/Steven/Desktop/Stuff/Documents/Projects/In Progress/Game/server.rb:45:in `initialize'
C:/Documents and Settings/Steven/Desktop/Stuff/Documents/Projects/In Progress/Game/server.rb:79:in `new'
C:/Documents and Settings/Steven/Desktop/Stuff/Documents/Projects/In Progress/Game/server.rb:79
[11/15/08 14:04:34 Logger]: Cleaned out logger. There were 20 entries.
[11/15/08 14:04:34 Server]: Saving objects...
[11/15/08 14:04:34 StorageMachine]: Saving given objects (96)...please wait...
[11/15/08 14:04:37 StorageMachine]: Saving player: Ellah
[11/15/08 14:04:37 StorageMachine]: Storing inventory
[11/15/08 14:04:37 StorageMachine]: Player saved: Ellah
[11/15/08 14:04:37 StorageMachine]: Connection re-added to Ellah
[11/15/08 14:04:47 StorageMachine]: ...done saving objects (99).
[11/15/08 14:04:47 Server]: Objects saved!
[11/15/08 14:04:58 Object]: Loading admin.rb
[11/15/08 14:04:58 Object]: Loading clothing.rb
[11/15/08 14:04:58 Object]: Loading combat.rb
[11/15/08 14:04:58 Object]: Loading communication.rb
[11/15/08 14:04:58 Object]: Loading custom.rb
[11/15/08 14:04:58 Object]: Loading emote.rb
[11/15/08 14:04:58 Object]: Loading generic.rb
[11/15/08 14:04:58 Object]: Loading movement.rb
[11/15/08 14:04:58 Object]: Loading news.rb
[11/15/08 14:04:58 Object]: Loading settings.rb
[11/15/08 14:04:58 Object]: Loading hasinventory.rb
[11/15/08 14:04:58 Object]: Loading news.rb
[11/15/08 14:04:58 Object]: Loading openable.rb
[11/15/08 14:04:58 Object]: Loading position.rb
[11/15/08 14:04:58 Object]: Loading pronoun.rb
[11/15/08 14:04:58 Object]: Loading reacts.rb
[11/15/08 14:04:58 Object]: Loading readable.rb
[11/15/08 14:04:58 Object]: Loading sittable.rb
[11/15/08 14:04:58 Object]: Loading wearable.rb
[11/15/08 14:04:58 Object]: Loading objects/area.rb
[11/15/08 14:04:58 Object]: Loading objects/chair.rb
[11/15/08 14:04:58 Object]: Loading objects/clothing_items.rb
[11/15/08 14:04:58 Object]: Loading objects/container.rb
[11/15/08 14:04:58 Object]: Loading objects/door.rb
[11/15/08 14:04:58 Object]: Loading objects/equipment.rb
[11/15/08 14:04:58 Object]: Loading objects/exit.rb
[11/15/08 14:04:58 Object]: Loading objects/inventory.rb
[11/15/08 14:04:58 Object]: Loading objects/mobile.rb
[11/15/08 14:04:58 Object]: Loading objects/newsboard.rb
[11/15/08 14:04:58 Object]: Loading objects/player.rb
[11/15/08 14:04:58 Object]: Loading objects/portal.rb
[11/15/08 14:04:58 Object]: Loading objects/prop.rb
[11/15/08 14:04:58 Object]: Loading objects/room.rb
[11/15/08 14:04:58 Object]: Loading objects/scroll.rb
[11/15/08 14:04:58 Object]: Loading objects/weapon.rb
[11/15/08 14:04:58 Object]: Server restart #1
[11/15/08 14:04:58 Manager]: Loading objects from storage...
[11/15/08 14:04:58 StorageMachine]: Loading all game objects...may take a while.
[11/15/08 14:04:58 StorageMachine]: Grabbing all the goids...
[11/15/08 14:04:58 StorageMachine]: Loading inventories and equipment...
[11/15/08 14:04:58 StorageMachine]: Don't have 57a65eca-ae04-6079-bf53-55da34b5d12e loaded...what does that mean? (Probably a Player)
[11/15/08 14:04:58 StorageMachine]: ...done loading inventories and equipment.
[11/15/08 14:04:58 Manager]: 95 objects have been loaded.
[11/15/08 14:04:58 Manager]: Starting event handler...
[11/15/08 14:04:58 Manager]: Event handler started.
[11/15/08 14:04:58 Manager]: Manager is running.
« Last Edit: November 15, 2008, 02:09:12 pm by Saffire » Logged
Justin
Administrator
Citizen
*****
Posts: 189



View Profile
« Reply #1 on: November 15, 2008, 02:15:25 pm »

Er, yeah. Don't do that.  Cheesy

The acreate command is pretty dangerous, because it will attempt to create anything for which a Ruby class has been defined and treat it like a GameObject.

Maybe in the future there will be more checks to prevent people from using it badly.
Logged
Andril
Wanderer
*
Posts: 7


View Profile
« Reply #2 on: January 10, 2009, 11:15:22 am »

Heh, I just HAD to try that myself. Monkey see, monkey do after all....

Then I just added

Code:
if klass == Player
  player.output "You trying to crash the game you... person?!" // slightly edited for the sake of propriety... heh
  return
end

to events/admin.rb at line 74-77 and presto! No more crashing from that. I'm so proud of myself. I imagine that if you were trying to run a full "production" mud from this base you'd probably want to put in a message about that being a no-no in the acreate ahelp entry, and probably have it logged with the name of any offender(s) trying it as well.

I was just testing to make sure you'd fixed the problem! Honestly!...  Roll Eyes
Logged
Justin
Administrator
Citizen
*****
Posts: 189



View Profile
« Reply #3 on: January 10, 2009, 11:33:55 am »

Actually, a better check would be:

Code:
if not klass.is_a? GameObject or klass.is_a? Player
    player.output "You cannot create  a #{klass}."
    return
end

Which I'll have in the next release.
Logged
Justin
Administrator
Citizen
*****
Posts: 189



View Profile
« Reply #4 on: February 28, 2009, 10:35:27 pm »

I hope no one actually used my code, because it was completely wrong  Embarrassed
Logged
Saffire
Citizen
***
Posts: 136


View Profile
« Reply #5 on: March 01, 2009, 09:29:56 am »

I did. Tongue

What was wrong with it?
Logged
Justin
Administrator
Citizen
*****
Posts: 189



View Profile
« Reply #6 on: March 01, 2009, 02:37:03 pm »

In this case, klass is actually an instance of Class, so it will never be a GameObject. Unless your klass is referring to something else.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.15 | SMF © 2006-2009, Simple Machines
Terra97 design by Bloc