ID:2366699
 
(See the best response by Ter13.)
Code:
mob/verb/Sharingan()
usr.Sharingan_ON()

mob/proc
Sharingan_ON()//var/stage)
for(var/obj/Jutsus/Doujutsu/Sharingan/J in src.JutsusLearnt)
if(J.Excluded)
return
var/boost = (Reflex *0.10)*Sharingan_Stage
var/boost2 = Critical *0.20*Sharingan_Stage
if(!src.Sharingan)
var/obj/Onscreen_Effect/Doujutsu/Sharingan/S1 = new(src.loc)
var/obj/Onscreen_Effect/Doujutsu/Sharingan/S2 = new(src.loc)
var/obj/Onscreen_Effect/Doujutsu/Change/C = new(src.loc)
src.Sharingan = 1
src.Maptext("Sharingan!",src)
Sound('sharingan sound effect.wav', volume=70, rand=0, fade=1)
spawn()
J.cooltimer=J.maxcooltime
J.JutsuCoolDown(src)
C.step_y = src.step_y;C.step_y = src.step_y
S1.icon_state = "left";S2.icon_state = "right";
S1.x-= 1;S1.step_x = src.step_x;S2.x+= 1;S2.step_x = src.step_x
S1.step_y = src.step_y;S2.step_y = src.step_y
S1.step_x-= 10; S2.step_x+= 10
sleep(10)
animate(S1, transform = matrix()*2, alpha = 0, time = 5)
animate(S2, transform = matrix()*2, alpha = 0, time = 5)
color = rgb(10 * 3+200, 200, 200)
Reflex+= boost
Critical+= boost2
else
src.Sharingan = null
color = null
Reflex-= boost
Critical-= boost2

Heres a code for the sharingan proc and verb.

mob
var
hotslot
hotslot1
hotslot2
hotslot3
hotslot4
hotslot5
hotslot6
hotslot7
hotslot8
hotslot9
hotslot10
proc
UpdateSlots()
for(var/obj/HotSlots/h in src.client.screen)
if(istype(h,/obj/HotSlots/HotSlot1))
var/image/I=image('Misc Effects.dmi',HotSlotSave["HotSlot1"])
I.pixel_x=12
h.overlays=null
h.overlays+=I
h.HotSlotNumber("F1")
if(istype(h,/obj/HotSlots/HotSlot2))
var/image/I=image('Misc Effects.dmi',HotSlotSave["HotSlot2"])
I.pixel_x=12
h.overlays=null
h.overlays+=I
h.HotSlotNumber("F2")
if(istype(h,/obj/HotSlots/HotSlot3))
var/image/I=image('Misc Effects.dmi',HotSlotSave["HotSlot3"])
I.pixel_x=12
h.overlays=null
h.overlays+=I
h.HotSlotNumber("F3")
if(istype(h,/obj/HotSlots/HotSlot4))
var/image/I=image('Misc Effects.dmi',HotSlotSave["HotSlot4"])
I.pixel_x=12
h.overlays=null
h.overlays+=I
h.HotSlotNumber("F4")
if(istype(h,/obj/HotSlots/HotSlot5))
var/image/I=image('Misc Effects.dmi',HotSlotSave["HotSlot5"])
I.pixel_x=12
h.overlays=null
h.overlays+=I
h.HotSlotNumber("F5")

doslot(txt)
if(txt=="Clone Jutsu") src.Clone_Jutsu()

if(txt=="Sharingan") src.Sharingan()
if(txt=="Byakugan") src.Byakugan()

if(txt=="Earth Style: Earth Wall") src.Earth_Style_Wall()
if(txt=="Earth Style: Earth Spikes") src.Earth_Style_Spikes()

HotSlots()
if(src.hotslot=="1")src.doslot(src.hotslot1)
if(src.hotslot=="2")src.doslot(src.hotslot2)
if(src.hotslot=="3")src.doslot(src.hotslot3)
if(src.hotslot=="4")src.doslot(src.hotslot4)
if(src.hotslot=="5")src.doslot(src.hotslot5)
if(src.hotslot=="6")src.doslot(src.hotslot6)
if(src.hotslot=="7")src.doslot(src.hotslot7)
if(src.hotslot=="8")src.doslot(src.hotslot8)
if(src.hotslot=="9")src.doslot(src.hotslot9)
if(src.hotslot=="10")src.doslot(src.hotslot10)
mob
verb
HotSlot1()
set hidden=1
usr.hotslot="1"
usr.HotSlots()
HotSlot2()
set hidden=1
usr.hotslot="2"
usr.HotSlots()
HotSlot3()
set hidden=1
usr.hotslot="3"
usr.HotSlots()
HotSlot4()
set hidden=1
usr.hotslot="4"
usr.HotSlots()
HotSlot5()
set hidden=1
usr.hotslot="5"
usr.HotSlots()
HotSlot6()
set hidden=1
usr.hotslot="6"
usr.HotSlots()
HotSlot7()
set hidden=1
usr.hotslot="7"
usr.HotSlots()
HotSlot8()
set hidden=1
usr.hotslot="8"
usr.HotSlots()
HotSlot9()
set hidden=1
usr.hotslot="9"
usr.HotSlots()
HotSlot10()
set hidden=1
usr.hotslot="10"
usr.HotSlots()

Heres the code for the hotslot system.

Problem description:
Now the issue I am having is when I use the sharingan verb, I am able to turn the Sharingan on and off with that single verb, but when i drag the jutsu obj into a hotslot, it basically only turns on Sharingan. Its as if the
if(!Sharingan)
blah blah blah....
else
TURN OFF
code is being ignored. What am I missing?

EDIT: I noticed, when i use the hotslot first and try to turn of sharingan with the verb, its as if it wasn't turned on so i guess the sharingan == 1 code isn't being implicated through the hotslot's doslot proc?
Your code is only calling sharingan on. Look at the sharingan verb. It is doing exactly what it should be.

Bookmarking thread for later, because your whole hotslot system needs to be rewritten.
But why isn't the if command being used through hotslots but it works with the verb?
Best response
Okay, I'm actually at a proper computer now and can respond like I planned.

The issue is that you have at least two different verbs defined for using the sharingan. One of them is different than the one you showed.

The one you are showing, that your hotslots are calling is actually only turning the sharingan on:

mob/verb/Sharingan()
usr.Sharingan_ON()


The issue is that the clickable verb you have implemented elsewhere in your code is not defined the same way, so you need to show that verb instead of the one above.


As for the rest of your code. There's a lot wrong that's making the whole thing a bloated, slow, confusing mess.

mob
var
list/abilities[10] //define a list that will hold the name of all any abilities stored in the player's hotslot
verb
hotslot(slot as num|null)
set hidden = 1, instant = 1
if(abilities && slot>=1 && slot<=abilities.len)
var/ability = "ability_[abilities[slot]]"
if(hascall(src,ability))
call(src,ability)()


Now let's set up the hotslot screen objects:

obj/slot_bg //this is just a visual placeholder for slot backgrounds
icon = 'ui.dmi'
icon_state = "bg"
plane = HUD_PLANE
layer = 0

obj/hotslot
icon = 'skills.dmi'
underlays = list(/obj/slot_bg) //set the background as an underlay, rather than adding a skill overlay.
var
slot
hotkey

New(slot,screen_loc,hotkey)
src.slot = slot
src.screen_loc = screen_loc
src.hotkey = hotkey
..()

Click()
usr.hotslot(slot)
..()

MouseDrop(atom/over_object,atom/src_location,atom/over_location,src_control,over_control,params)
if(istype(over_object,/obj/hotslot)) //called when dragging this hotslot onto another hotslot
usr.abilities.Swap(slot,over_object:slot)
over_object:Update(usr.abilities[over_object:slot])
else
usr.abilities[slot] = null //null out the ability in the user's hotbar
Update(usr.abilities[slot])
..()

proc
Update(ability=icon_state,hotkey=hotkey)
icon_state = ability
maptext = hotkey


To add the new screen objects to the screen, we just need to create them:

client
var
list/hotslots
list/hotkeys = list("1","2","3","4","5","6","7","8","9","0")
New()
. = ..()
if(.)
BuildHotbar()

proc
BuildHotbar()
hotslots = new/list(10)
for(var/count in 1 to 10) //populate the hotslot list with hotslot screen objects
hotslots[count] = new/obj/hotslot(count,"[count],1",hotkeys[count])
screen += hotslots


That's a much more compressed and robust system than the one you are using.

But yeah, overall the source of your problem is that you have two conflicting implementations that are doing different things than you think they are.
Thanks for the help on hotslots. As for the Sharingan, yes it says Sharingan_On but it actually controls turning it on and off. Did you read the codes all the way?

(I dont know why I named it Sharingan ON, think I may have wanted to do a differnt type of system for it but ended up changing my mind)
If the clickable verb is the same as the one the hotslot is calling, they cannot be operating differently.

It's as simple as that. I did read the code all the way through. If they are operating differently from hotslot to clickable verb, that means that the same code isn't being called.

That's the only possibility if the code is behaving differently. You need to narrow down what's happening by inserting debug messages and figuring out where the problem is located using those debug messages.
Oh, I see what you're saying. Maybe I didn't type into enough detail. When I run the proc/verb via hotslot it runs the same codes and actuallys calls it correctly! It just doesn't get down the the part of the proc that turns off the sharingan. There is only one verb/proc for the sharingan, nothing else. But I will still try out debugging it
Out of curiosity, is it possible that the character you are testing this on has two /obj/Jutsus/Doujutsu/Sharingan objects in the player's JutsusLearnt list?

Since you are using a for loop per sharingan jutsu in that list, it's possible that it's turning itself on and then turning itself off, or vice-versa. But again, both the verb and the hotslot version would behave consistently.
Nope, only one Sharingan and one Byakugan in the type. And thats what I thought too, but they aren't sadly and I knew i wasn't crazy..
Never got a conclusion to this, any further suggestions?
Put in some debugging outputs and test what's going on.