• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Do You Use Ruby For Warcraft 3, too?

Status
Not open for further replies.
Level 6
Joined
Apr 16, 2007
Messages
177
Once I used python, but since my mom showed me ruby I do all the stuff in ruby. Things like Tooltip Creators that just take name, cooldown, description and level description are so easy to code using ruby's eval method <3

When I still had the old weapon system, I had all my combining, doubling, upgrading, cost and weight functions with python just like the weapon descriptions and tooltips : D

Just two lines and I did have another 10 lines of code in my map^^

Are you also using scripting languages in general and ruby in special for increasing your coding effency and getting a better consistency?
 
Ok. I, however, just use it as a scripting language, I never built a real app with it.

Using it mainly for things like

Code:
def print_skill_text( name, cooldown, learn_tip, level_tip )
  puts "#{name} - [ %d / 6 ]"
  if cooldown then
    puts "[cooldown: #{cooldown} seconds]"
  else
    puts "[passive]"
  end
  1.upto(6){ |level|
     help_string = eval '"' + level_tip + '"'   #dunno why it doesn't work with calling eval directly, need to use this helper variable
     puts "Level #{ level } - #{ help_string }" 
  }
end

print_skill_text( "Shados-Hull", nil, "Increases the armor of the hero", '#{ level + 1 } additional armor' )
 
That above code should use a block:
Code:
def print_skill_text( name, cooldown, learn_tip)
  puts "#{name} - [ %d / 6 ]"
  if cooldown then
    puts "[cooldown: #{cooldown} seconds]"
  else
    puts "[passive]"
  end
  1.upto(6){ |level|
     help_string = yield level
     puts "Level #{ level } - #{ help_string }" 
  }
end

print_skill_text( "Shados-Hull", nil, "Increases the armor of the hero" ){ |level|
  "#{ level + 1 } additional armor"
}
 
Status
Not open for further replies.
Back
Top