Save-Point

Full Version: Save-Point
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Board Message
Sorry, you do not have permission to access this resource.
Save-Point - Help with this script

Save-Point

Full Version: Help with this script
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Well, I found out this jap script that makes an Item Librarby, and I fell in love with it. However, there's one thing I don't like: when you open an item's description, if that item has any element, it draws the name of the element. For example:

Sword

Element: Fire

Now, that's not too bad, but when you get more than 2 or 3 elements, it gets messy. So, I was wondering how I could make it so, instead of the text, you could get some icons on a custom directory (or the icons directory, w/e). Does anyone here knows how to do it?

Here's the part of the script that deals with elements. Credits goes ot the Jap creator, altho I have no idea who that is =(

Code:
def draw_attack_element(x, y, element_set)
elem_temp = []
for i in element_set
elem = $data_system.elements[i]
elem_temp.push("Fire") if elem == "Fire"
elem_temp.push("Ice") if elem == "Ice"
elem_temp.push("Thunder") if elem == "Thunder"
elem_temp.push("Water") if elem == "Water"
elem_temp.push("Earth") if elem == "Earth"
elem_temp.push("Wind") if elem == "Wind"
elem_temp.push("Aica") if elem == "Light"
elem_temp.push("Kaim") if elem == "Darkness"
end
if elem_temp.size == 0
self.contents.draw_text(x, y, 64, 32, "None")
return
end
ox = 0
for name in elem_temp
cx = self.contents.text_size(name).width
self.contents.draw_text(x+ox, y, cx, 32, name)
ox += cx+8
end
end
Code:
draw_attack_element(4+96+16, 96, item.guard_element_set)

I guess that should be enough to figure out how it works. As far as I can tell, there's no other part of the script messing with this, but if you want it complete, I'll post it.

Thanks in advance.
hello
could you please post the totality of the script
Thanks, but I alredy found another script that does exactly what I was looking for (I think it's based on this same script, actually). So, thanks, but I kinda solved it on my own alredy ^^

Laun~
Code:
for i in element_set
  elem = $data_system.elements[i]
  elem_temp.push("Fire") if elem == "Fire"
  elem_temp.push("Ice") if elem == "Ice"
  elem_temp.push("Thunder") if elem == "Thunder"
  elem_temp.push("Water") if elem == "Water"
  elem_temp.push("Earth") if elem == "Earth"
  elem_temp.push("Wind") if elem == "Wind"
  elem_temp.push("Aica") if elem == "Light"
  elem_temp.push("Kaim") if elem == "Darkness"
end
I think it should be written like this...

Code:
for i in element_set
  elem = $data_system.elements[i]
  elem_temp.push elem unless elem == "Light" | "Darkness"
  elem_temp.push "Aica" if elem == "Light"
  elem_temp.push "Kaim" if elem == "Darkness"
end

To draw an icon you can use this...

IIRC if no window is used...

self.bitmap.blt(rect, filename)

...if there's a window, use...

self.contents.blt(rect, filename)

...and use conditions like the one included in the for loop for every possible icon you might need being displayed on screen.
Well, if you take the fact that I sux at scripting, and add that to the fact english is not my main language... well, I dind't really got what you said lol. I do understand the part where you change the script to write the element's name unless it's Darkness or Light (the only ones with a diferent name on the game and the database) . So, I guess that the | symbol is like an "or", right? Sorry, I told ya I sux at this xD

Anyways, as long as I do got a new script that does this exact same thing, can you tell me how it would look on the second part? So I don't have to make it like:

Code:
if elem == "Fire"
self.contents.blt(rect, Fire)
end
if elem == "Ice"
self.contents.blt(rect, Ice)
etc...

A tag to look for the element's name, and take the icon with the matching name and put it on the window... that's kinda what I'm looking for, I guess. Something like:

Code:
icon = $data_system.icons[$data_system.elements[i]]

self.contents.blt(rect, icon)

Something like that (I know that my example sux. Sorry for not getting a better one >.<


Sorry if I'm not clear, just starting with all this scripting thing.

Yours,
Laun~