obj
skillcards
icon_state = "normal"
layer = 6//Give it a layer higher than anything else
MouseEntered()//When the mouse enters
icon_state = "mouseover"//change the icon
MouseExited()//When the mouse exits
sleep(1)//Wait 1/10 of a second
icon_state = "normal"//change the icon
s_one
screen_loc = "1,1"//The X and Y Locations on screen
s_two
screen_loc = "2,1"
s_three
screen_loc = "3,1"
s_four
screen_loc = "4,1"
s_five
screen_loc = "5,1"
s_six
screen_loc = "6,1"
s_seven
screen_loc = "7,1"
s_eight
screen_loc = "8,1"
s_nine
screen_loc = "9,1"
s_zero
screen_loc = "10,1"
obj
test_objects
layer = 7
var/neverclicked
var/mob/player/P
var/atom/A
Click()
src.P = usr
if(!neverclicked)
neverclicked = 1
switch(alert("Would you like to macro this?",,"Yes","No"))
if("Yes")
var/number = round(input(usr,"Which key would you like to macro this to? Enter a number between 1 and 10 (Decimals will be rounded down).","Input") as num)
if(number < 1||number > 10)//Don't allow them to enter an improper value
usr << "Value entered was too small/large. Please enter a value between 1 and 10."
neverclicked = null
return
else
usr << "[number] = number"//Test, Just in case
usr << "[P.current_set_list] = current_set_list"//Test, Just in case
if(P.current_set_list == 1)
P.setmacros_1[number] = null//Make that # in the list null
// var/setup = P.screenobjects[number]//Define a variable as object in list
// setup.overlays += src
// P.setmacros_1[number] += //Add the clicked overlay
// var/overlayadd = P.screenobjects[number]
// overlayadd.overlays+=P.setmacros_1[number]
/* else if(P.current_set_list == 2)//Redundant
P.setmacros_2[number] -= A
P.setmacros_2[number] += A
else if(P.current_set_list == 3)
P.setmacros_3[number] -= A
P.setmacros_3[number] += A
else if(P.current_set_list == 4)
P.setmacros_4[number] -= A
P.setmacros_4[number] += A
else if(P.current_set_list == 5)
P.setmacros_5[number] -= A
P.setmacros_5[number] += A
else if(P.current_set_list == 6)
P.setmacros_6[number] -= A
P.setmacros_6[number] += A*/
neverclicked = null
if("No")
neverclicked = null
else if(neverclicked)
usr << "You currently are already setting up a macro."
else
usr << "<big>Error.</big>"
// if("No")
// return
purple
icon_state = "purple"
blue
icon_state = "blue"
green
icon_state = "green"
red
icon_state = "red"
orange
icon_state = "orange"
mob/player/var/tmp/list/testOBJS = list(new/obj/test_objects/purple,new/obj/test_objects/blue,new/obj/test_objects/green,new/obj/test_objects/red,new/obj/test_objects/orange)
//This list is added to your contents when you login, under Unrelated.dm
mob/player/var/list/setmacros_1[10]//These lists are used to add the icon overlays
mob/player/var/list/setmacros_2[10]
mob/player/var/list/setmacros_3[10]
mob/player/var/list/setmacros_4[10]
mob/player/var/list/setmacros_5[10]
mob/player/var/list/setmacros_6[10]
mob/player/var/list/macrocommand_1[10]//These lists are used to set the macros (Didn't do yet)
mob/player/var/list/macrocommand_2[10]
mob/player/var/list/macrocommand_3[10]
mob/player/var/list/macrocommand_4[10]
mob/player/var/list/macrocommand_5[10]
mob/player/var/list/macrocommand_6[10]
mob/player/var/tmp/list/screenobjects = list(new /obj/skillcards/s_one,new /obj/skillcards/s_two,new /obj/skillcards/s_three,new /obj/skillcards/s_four,new /obj/skillcards/s_five,new /obj/skillcards/s_six,new /obj/skillcards/s_seven,new /obj/skillcards/s_eight,new /obj/skillcards/s_nine,new /obj/skillcards/s_zero)
//This list is of the objects that are added to the client's screen upon login
mob/player/var/tmp/current_set_list = 0
//The set list being used Variable
var/tmp/SM = 0//Used in Scroll_List() proc to set where setmacros_# is being manipulated
var/tmp/SO = 0//Used in Scroll_List() proc to set which OBJ in screenobjects is getting an overlay
mob/player/var/tmp/Allowed = 1//Variable to check whether Scroll_List() is currently being used or not
mob/player/proc/Scroll_List()
if(Allowed)
Allowed = null
usr << "In process . . ."
current_set_list++
if(current_set_list<=6)//We want the number to be between 1 and 6
current_set_list = 1//If bigger or already equals 6, set to 1
if(SM>10&&SO>10)
for(SM>10&&SO>10)
usr << "<font color = red>Set list = [current_set_list], For SM>10&&SO>10, SM = [SM], SO = [SO]</font>"//Test, Just in case
SM++
SO++
usr << "<font color = blue>Set list = [current_set_list], SM++, SO++, SM = [SM], SO = [SO]</font>"//Test, Just in case
screenobjects[SO]-=overlays
if(current_set_list == 1)//Whatever the variable is
screenobjects[SO]+=setmacros_1[SM]//add the object, to the object SO in screenobjects, on the list spot of SM
else if(current_set_list == 2)//This part is redundant, but I don't know of a better way.
screenobjects[SO]+=setmacros_2[SM]
else if(current_set_list == 3)
screenobjects[SO]+=setmacros_3[SM]
else if(current_set_list == 4)
screenobjects[SO]+=setmacros_4[SM]
else if(current_set_list == 5)
screenobjects[SO]+=setmacros_5[SM]
else if(current_set_list == 6)
screenobjects[SO]+=setmacros_6[SM]
else
usr << "<big>Error.</big>"
usr << "<font color=purple>Set list = [current_set_list], SM = [SM], SO = [SO]S</font>"//Test, Just in case
else if(SM<=10||SO<=10)
Allowed = 1
usr << "<font color = orange>Complete. Allowed = [Allowed]. Set list = [current_set_list]</font>"//Test, Just in case
else if(!Allowed)
usr << "Currently not allowed. Allowed = [Allowed]"
else
usr << "<big>Error.</big>"//Test, Just in case
Problem description:
I am trying to, in the empty If statement, have an object in the setmacros list be null. Then, to add an object in that spot. Then, to take the object from that spot in the list and add it to an overlay from an object in the same spot in the screenobjects list.
You can download a complete version of the demo here:
http://quickupload.net/i65vszthjk1e/ Macro_Demo_src-quickupload.net.zip.html
Thanks for any help!
I do see several design flaws which should probably be addressed first. There is no apparent need for 10 subtypes under /obj/skillcards, when a single type and a var will suffice. You have six different lists each for macros and their definitions, which suggests you'd be better off going with a multidimensional list [6][10] or with a single combined list [60]. Without knowing the purpose of the system I'm not sure which way to steer you, but when you have a ton of vars that have the same purpose like macro1, macro2, macro3, etc., that's a red flag that your design needs a rethink.
Also, just so you know it is bad practice (for readability) when using // comments not to put some spacing between the rest of the line and the comment. A tab is usually the preferred choice.
Lummox JR